Compare commits
185 Commits
Author | SHA1 | Date |
---|---|---|
Manos Pitsidianakis | bc1b65316d | |
Manos Pitsidianakis | 11a0586d56 | |
Manos Pitsidianakis | f70496f14c | |
Manos Pitsidianakis | 8a16cf6db4 | |
Manos Pitsidianakis | 11f3077b06 | |
Manos Pitsidianakis | dedee908d1 | |
Manos Pitsidianakis | 255e93764a | |
Manos Pitsidianakis | c5e9e67604 | |
Manos Pitsidianakis | ae96038fbf | |
Manos Pitsidianakis | 07072e2e3f | |
Manos Pitsidianakis | aa5737a004 | |
Manos Pitsidianakis | 48cb9ee204 | |
Guillaume Ranquet | c53a32de4c | |
Manos Pitsidianakis | a69c674c07 | |
Manos Pitsidianakis | 6a66afe93e | |
Manos Pitsidianakis | 974502c6ff | |
Manos Pitsidianakis | 3e9144657b | |
Manos Pitsidianakis | 35a9f33aab | |
Manos Pitsidianakis | 475609fe92 | |
Manos Pitsidianakis | 38bca8f8bc | |
Manos Pitsidianakis | ec01a4412a | |
Manos Pitsidianakis | 4e941a9e8b | |
Manos Pitsidianakis | 742f038f74 | |
Manos Pitsidianakis | 484712b0c3 | |
Manos Pitsidianakis | 264782d228 | |
Manos Pitsidianakis | 41e965b8a3 | |
Manos Pitsidianakis | f31b5c4000 | |
Manos Pitsidianakis | 8014af2563 | |
Manos Pitsidianakis | 4ce616aeca | |
Manos Pitsidianakis | a3aaec382a | |
Manos Pitsidianakis | b8b24282a0 | |
Manos Pitsidianakis | e481880321 | |
Geert Stappers | a88b8c5ea0 | |
Manos Pitsidianakis | b820bd6d9c | |
Manos Pitsidianakis | 3b93fa8e7c | |
Manos Pitsidianakis | 634bd1917a | |
Manos Pitsidianakis | b5fd3f57a7 | |
Manos Pitsidianakis | 1fcb1d59b8 | |
Manos Pitsidianakis | e2cdebe89c | |
Manos Pitsidianakis | 3884c0da1f | |
Manos Pitsidianakis | 26928e3ae9 | |
Manos Pitsidianakis | 070930e671 | |
Manos Pitsidianakis | c7aee72525 | |
Manos Pitsidianakis | 30a3205e4f | |
Manos Pitsidianakis | 9af284b8db | |
Manos Pitsidianakis | 62aee4644b | |
Manos Pitsidianakis | 5af2e1ee66 | |
Manos Pitsidianakis | 4e7b665672 | |
Manos Pitsidianakis | fd64fe0bf8 | |
Manos Pitsidianakis | 51e3f163d4 | |
Manos Pitsidianakis | 417b24cd84 | |
Manos Pitsidianakis | 873a67d0fb | |
Manos Pitsidianakis | c332c2f5ff | |
Manos Pitsidianakis | 1048ce6824 | |
Manos Pitsidianakis | 70fc2b455c | |
Manos Pitsidianakis | 8de8addd11 | |
Manos Pitsidianakis | 1fe3619208 | |
Manos Pitsidianakis | 0b468d88ad | |
Manos Pitsidianakis | 1eca34b398 | |
Manos Pitsidianakis | 5afc078587 | |
Guillaume Ranquet | a37d5fc1d1 | |
Manos Pitsidianakis | 60f26f9dae | |
Ethra | e80ea9c9de | |
Manos Pitsidianakis | 64e60cb0ee | |
Manos Pitsidianakis | 81d1c0536b | |
Manos Pitsidianakis | cd448924ed | |
Manos Pitsidianakis | 61a0c3c27f | |
Manos Pitsidianakis | 7952006870 | |
Manos Pitsidianakis | ddab3179c2 | |
Manos Pitsidianakis | 7861fb0402 | |
Manos Pitsidianakis | 148f0433d9 | |
Manos Pitsidianakis | 8185f2cf7d | |
Manos Pitsidianakis | 0270db0123 | |
Manos Pitsidianakis | 8ddd673dd8 | |
Manos Pitsidianakis | e3351d2755 | |
Manos Pitsidianakis | 31401fa35c | |
Manos Pitsidianakis | 33408146a1 | |
Manos Pitsidianakis | 8a95febb78 | |
Manos Pitsidianakis | 73d5b24e98 | |
Manos Pitsidianakis | 0da97dd8c1 | |
Manos Pitsidianakis | 933bf157ae | |
Manos Pitsidianakis | f685726eac | |
Manos Pitsidianakis | ab1b946fd9 | |
Manos Pitsidianakis | ce4ba06ce9 | |
Manos Pitsidianakis | bebb473d1b | |
Manos Pitsidianakis | f0866a3965 | |
Manos Pitsidianakis | f63774fa6d | |
Manos Pitsidianakis | 808aa4942d | |
Manos Pitsidianakis | 08518e1ca8 | |
Manos Pitsidianakis | 34a2d52e7e | |
Manos Pitsidianakis | 4026e25428 | |
Manos Pitsidianakis | ca7d7bb95d | |
Manos Pitsidianakis | ebe1b3da7e | |
Manos Pitsidianakis | 506ae9f594 | |
Manos Pitsidianakis | b6f769b2f4 | |
Manos Pitsidianakis | 3691cd2962 | |
Manos Pitsidianakis | 97eb636375 | |
Manos Pitsidianakis | b3079715f6 | |
Manos Pitsidianakis | 86bbf1ea57 | |
Manos Pitsidianakis | 1b0bdd0a9a | |
Manos Pitsidianakis | 7412c23870 | |
Manos Pitsidianakis | 500fe7f7e4 | |
Manos Pitsidianakis | 2419f4bd40 | |
Manos Pitsidianakis | 59c99fdc79 | |
Manos Pitsidianakis | 5f8d7c8039 | |
Manos Pitsidianakis | 876616d45b | |
Manos Pitsidianakis | c41f35fdd5 | |
Manos Pitsidianakis | 773254864b | |
Manos Pitsidianakis | e19f3e572c | |
Manos Pitsidianakis | 1617212c5b | |
Manos Pitsidianakis | 3ba1603af2 | |
Manos Pitsidianakis | 0a617410ec | |
Manos Pitsidianakis | 5ff4e8ae68 | |
Manos Pitsidianakis | c4344529e3 | |
Manos Pitsidianakis | f900dbea46 | |
Manos Pitsidianakis | f3e85738e7 | |
Manos Pitsidianakis | 3a70979483 | |
Manos Pitsidianakis | 24971d1960 | |
Manos Pitsidianakis | e37997d697 | |
Manos Pitsidianakis | 3adba40e32 | |
Manos Pitsidianakis | da251455a0 | |
Manos Pitsidianakis | d16afc7d8d | |
Manos Pitsidianakis | 7eedd86051 | |
Manos Pitsidianakis | c751b2e845 | |
Manos Pitsidianakis | 031d0f7dc7 | |
Manos Pitsidianakis | 2c6f180df9 | |
Manos Pitsidianakis | 63a63253d7 | |
Manos Pitsidianakis | 71f3ffe740 | |
Manos Pitsidianakis | 10c3b0eabe | |
Andrei Zisu | 64898a0583 | |
Andrei Zisu | 77a8d9e2c2 | |
Manos Pitsidianakis | ed8a5de2cb | |
Manos Pitsidianakis | b5cc2a095f | |
Manos Pitsidianakis | 5dd71ef1cd | |
Manos Pitsidianakis | 28fa66cc2a | |
Manos Pitsidianakis | 3b4acc15a5 | |
Manos Pitsidianakis | 23c15261e7 | |
Manos Pitsidianakis | 62b8465f2c | |
Manos Pitsidianakis | 1c1be7d6c9 | |
Manos Pitsidianakis | ccf6f9a26e | |
Manos Pitsidianakis | 3495ffd61b | |
Manos Pitsidianakis | 458258e1aa | |
Manos Pitsidianakis | d018f07aa5 | |
Manos Pitsidianakis | 0114e69542 | |
Manos Pitsidianakis | 0a74c7d0e5 | |
Manos Pitsidianakis | 54d21f25fd | |
Manos Pitsidianakis | ba7a97e90b | |
Manos Pitsidianakis | bcec745c24 | |
Manos Pitsidianakis | b61fc3ab64 | |
Manos Pitsidianakis | c2ae19d120 | |
Manos Pitsidianakis | 84f3641ec1 | |
Manos Pitsidianakis | 0e3a0c4b70 | |
Manos Pitsidianakis | 7645ff1b87 | |
Manos Pitsidianakis | e0adcdfe15 | |
Manos Pitsidianakis | ab14f81900 | |
Manos Pitsidianakis | cd2ba80f8e | |
Manos Pitsidianakis | c1c41c9126 | |
Manos Pitsidianakis | a1cbb1988b | |
Manos Pitsidianakis | 470cae6b88 | |
Manos Pitsidianakis | 23507932f9 | |
Manos Pitsidianakis | 0500e451da | |
Manos Pitsidianakis | 6506fffb94 | |
Manos Pitsidianakis | f81a1e2338 | |
Manos Pitsidianakis | ef30228e08 | |
Manos Pitsidianakis | 111a1160ad | |
Manos Pitsidianakis | bfc78a0803 | |
Manos Pitsidianakis | 7387b67eee | |
Manos Pitsidianakis | af241d25cb | |
Manos Pitsidianakis | fa33a9468a | |
Manos Pitsidianakis | 2db021fa0a | |
Manos Pitsidianakis | 43bfd4131d | |
Manos Pitsidianakis | ac2a5dcdd1 | |
Manos Pitsidianakis | 688e39a67e | |
Manos Pitsidianakis | 0e60bdf26e | |
Manos Pitsidianakis | 8a21be2177 | |
Manos Pitsidianakis | 606f487fc5 | |
Manos Pitsidianakis | 0f3b529459 | |
Manos Pitsidianakis | 5a7919bb03 | |
Manos Pitsidianakis | f702dc220c | |
Andrei Zisu | e95c275d68 | |
Andrei Zisu | 3105a0373b | |
Andrei Zisu | 7aec5b8e78 | |
Manos Pitsidianakis | e1b55340fa | |
Manos Pitsidianakis | d3cbf184e6 | |
Manos Pitsidianakis | e88957ae6e |
|
@ -0,0 +1,2 @@
|
|||
[env]
|
||||
PCRE2_SYS_STATIC = "1"
|
|
@ -0,0 +1,2 @@
|
|||
# Use cargo-derivefmt to sort derives alphabetically
|
||||
f900dbea468e822c5a510a72ecc6367549443927
|
|
@ -0,0 +1,65 @@
|
|||
# SPDX-License-Identifier: EUPL-1.2
|
||||
name: Build .deb package
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_NET_RETRY: 10
|
||||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
|
||||
RUSTFLAGS: "-D warnings -W unreachable-pub -W rust-2021-compatibility"
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
RUST_BACKTRACE: short
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Package for debian on ${{ matrix.arch }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build: [linux-amd64, ]
|
||||
include:
|
||||
- build: linux-amd64
|
||||
arch: amd64
|
||||
os: ubuntu-latest
|
||||
rust: stable
|
||||
artifact_name: 'linux-amd64'
|
||||
target: x86_64-unknown-linux-gnu
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- id: os-deps
|
||||
name: install OS dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y mandoc debhelper quilt build-essential
|
||||
- id: rustup-setup
|
||||
name: Install rustup and toolchains
|
||||
shell: bash
|
||||
run: |
|
||||
if ! command -v rustup &>/dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
|
||||
source "${HOME}/.cargo/env"
|
||||
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
|
||||
echo "CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}" >> $GITHUB_ENV
|
||||
rustup toolchain install --profile minimal ${{ matrix.rust }} --target ${{ matrix.target }}
|
||||
rustup default ${{ matrix.rust }}
|
||||
fi
|
||||
- name: Build binary
|
||||
run: |
|
||||
VERSION=$(grep -m1 version meli/Cargo.toml | head -n1 | cut -d'"' -f 2 | head -n1)
|
||||
make deb-dist
|
||||
mkdir artifacts
|
||||
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
mv ../meli_*.deb artifacts/meli-${VERSION}-${{ matrix.artifact_name }}.deb
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: meli-${{env.VERSION}}-${{ matrix.artifact_name }}.deb
|
||||
path: artifacts/meli-${{env.VERSION}}-${{ matrix.artifact_name }}.deb
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
|
@ -1,3 +1,4 @@
|
|||
# SPDX-License-Identifier: EUPL-1.2
|
||||
name: Build release binary
|
||||
|
||||
env:
|
||||
|
@ -29,7 +30,7 @@ jobs:
|
|||
artifact_name: 'meli-linux-amd64'
|
||||
target: x86_64-unknown-linux-gnu
|
||||
steps:
|
||||
- uses: https://github.com/actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- id: os-deps
|
||||
name: install OS dependencies
|
||||
run: |
|
||||
|
@ -42,13 +43,16 @@ jobs:
|
|||
# path: ~/.rustup
|
||||
# key: toolchain-${{ matrix.os }}-${{ matrix.rust }}
|
||||
#- if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }}
|
||||
- name: Install Rust ${{ matrix.rust }}
|
||||
uses: https://github.com/actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.rust }}
|
||||
target: ${{ matrix.target }}
|
||||
override: true
|
||||
- id: rustup-setup
|
||||
name: Install rustup and toolchains
|
||||
shell: bash
|
||||
run: |
|
||||
if ! command -v rustup &>/dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
|
||||
source "${HOME}/.cargo/env"
|
||||
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
|
||||
rustup toolchain install --profile minimal ${{ matrix.rust }} --target ${{ matrix.target }}
|
||||
fi
|
||||
- name: Configure cargo data directory
|
||||
# After this point, all cargo registry and crate data is stored in
|
||||
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
|
||||
|
@ -78,9 +82,9 @@ jobs:
|
|||
mv target/release/* target/ || true
|
||||
mv target/meli artifacts/
|
||||
- name: Upload Artifacts
|
||||
uses: https://github.com/actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.artifact_name }}
|
||||
path: artifacts
|
||||
path: artifacts/meli
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
retention-days: 30
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
# SPDX-License-Identifier: EUPL-1.2
|
||||
name: Run cargo lints
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_NET_RETRY: 10
|
||||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
|
||||
RUSTFLAGS: "-D warnings -W unreachable-pub -W rust-2021-compatibility -C debuginfo=0"
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
RUST_BACKTRACE: short
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.gitea/**'
|
||||
- 'melib/src/**'
|
||||
- 'melib/Cargo.toml'
|
||||
- 'meli/src/**'
|
||||
- 'meli/Cargo.toml'
|
||||
- 'Cargo.toml'
|
||||
- 'Cargo.lock'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Lint on ${{ matrix.build }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build: [linux-amd64, ]
|
||||
include:
|
||||
- build: linux-amd64
|
||||
os: ubuntu-latest
|
||||
rust: stable
|
||||
target: x86_64-unknown-linux-gnu
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- id: os-deps
|
||||
name: install OS dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y libdbus-1-dev pkg-config mandoc libssl-dev
|
||||
#- id: cache-rustup
|
||||
# name: Cache Rust toolchain
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: ~/.rustup
|
||||
# key: toolchain-${{ matrix.os }}-${{ matrix.rust }}
|
||||
#- if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }}
|
||||
- id: rustup-setup
|
||||
name: Install Rustup and toolchains
|
||||
shell: bash
|
||||
run: |
|
||||
if ! command -v rustup &>/dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
|
||||
source "${HOME}/.cargo/env"
|
||||
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
|
||||
rustup toolchain install --profile minimal --component clippy,rustfmt --target ${{ matrix.target }} -- "${{ matrix.rust }}"
|
||||
rustup default ${{ matrix.rust }}
|
||||
fi
|
||||
- name: Configure cargo data directory
|
||||
# After this point, all cargo registry and crate data is stored in
|
||||
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
|
||||
# that are needed during the build process. Additionally, this works
|
||||
# around a bug in the 'cache' action that causes directories outside of
|
||||
# the workspace dir to be saved/restored incorrectly.
|
||||
run: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
|
||||
#- id: cache-cargo
|
||||
# name: Cache cargo configuration and installations
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
# with:
|
||||
# path: ${{ env.CARGO_HOME }}
|
||||
# key: cargo-${{ matrix.os }}-${{ matrix.rust }}
|
||||
#- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
|
||||
- name: Setup Rust target
|
||||
run: |
|
||||
mkdir -p "${{ env.CARGO_HOME }}"
|
||||
cat << EOF > "${{ env.CARGO_HOME }}"/config.toml
|
||||
[build]
|
||||
target = "${{ matrix.target }}"
|
||||
EOF
|
||||
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
|
||||
name: Add lint dependencies
|
||||
run: |
|
||||
cargo install --quiet --version 1.0.9 --target "${{ matrix.target }}" cargo-sort
|
||||
RUSTFLAGS="" cargo install --locked --target "${{ matrix.target }}" --git https://github.com/dcchut/cargo-derivefmt --rev 2ff93de7fb418180458dd1ba27e5655607c23ab6 --bin cargo-derivefmt
|
||||
- name: rustfmt
|
||||
if: success() || failure()
|
||||
run: |
|
||||
cargo fmt --check --all
|
||||
- name: clippy
|
||||
if: success() || failure()
|
||||
run: |
|
||||
cargo clippy --no-deps --all-features --all --tests --examples --benches --bins
|
||||
- name: cargo-derivefmt melib
|
||||
if: success() || failure()
|
||||
run: |
|
||||
cargo derivefmt --manifest-path ./melib/Cargo.toml
|
||||
- name: cargo-derivefmt meli
|
||||
if: success() || failure()
|
||||
run: |
|
||||
cargo derivefmt --manifest-path ./meli/Cargo.toml
|
||||
- name: cargo-derivefmt fuzz
|
||||
if: success() || failure()
|
||||
run: |
|
||||
cargo derivefmt --manifest-path ./fuzz/Cargo.toml
|
||||
- name: cargo-derivefmt tools
|
||||
if: success() || failure()
|
||||
run: |
|
||||
cargo derivefmt --manifest-path ./tools/Cargo.toml
|
|
@ -0,0 +1,91 @@
|
|||
# SPDX-License-Identifier: EUPL-1.2
|
||||
name: Cargo manifest lints
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_NET_RETRY: 10
|
||||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
|
||||
RUSTFLAGS: "-D warnings -W unreachable-pub -W rust-2021-compatibility -C debuginfo=0"
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
RUST_BACKTRACE: short
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- '.gitea/**'
|
||||
- 'melib/Cargo.toml'
|
||||
- 'meli/Cargo.toml'
|
||||
- 'fuzz/Cargo.toml'
|
||||
- 'tool/Cargo.toml'
|
||||
- 'Cargo.toml'
|
||||
- 'Cargo.lock'
|
||||
- '.cargo/config.toml'
|
||||
|
||||
jobs:
|
||||
manifest_lint:
|
||||
name: Lint Cargo manifests on ${{ matrix.build }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build: [linux-amd64, ]
|
||||
include:
|
||||
- build: linux-amd64
|
||||
os: ubuntu-latest
|
||||
rust: stable
|
||||
target: x86_64-unknown-linux-gnu
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- id: os-deps
|
||||
name: install OS dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y mandoc
|
||||
- name: Find meli MSRV from meli/Cargo.toml.
|
||||
run: echo MELI_MSRV=$(grep -m1 rust-version meli/Cargo.toml | head -n1 | cut -d'"' -f 2 | head -n1) >> $GITHUB_ENV
|
||||
- id: rustup-setup
|
||||
name: Install Rustup and toolchains
|
||||
shell: bash
|
||||
run: |
|
||||
if ! command -v rustup &>/dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
|
||||
source "${HOME}/.cargo/env"
|
||||
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
|
||||
echo "CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}" >> $GITHUB_ENV
|
||||
rustup toolchain install --profile minimal --component "rustfmt" --target "${{ matrix.target }}" -- "${{ env.MELI_MSRV }}"
|
||||
rustup component add rustfmt --toolchain ${{ env.MELI_MSRV }}-${{ matrix.target }}
|
||||
rustup toolchain install --profile minimal --component "rustfmt" --target "${{ matrix.target }}" -- "${{ matrix.rust }}"
|
||||
rustup component add rustfmt --toolchain ${{ matrix.rust }}-${{ matrix.target }}
|
||||
rustup default ${{ matrix.rust }}
|
||||
fi
|
||||
- name: Setup Rust target
|
||||
run: |
|
||||
mkdir -p "${{ env.CARGO_HOME }}"
|
||||
cat << EOF > "${{ env.CARGO_HOME }}"/config.toml
|
||||
[build]
|
||||
target = "${{ matrix.target }}"
|
||||
EOF
|
||||
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
|
||||
name: Add manifest lint dependencies
|
||||
run: |
|
||||
source "${HOME}/.cargo/env"
|
||||
cargo install --quiet --version 1.0.9 --target "${{ matrix.target }}" cargo-sort
|
||||
cargo install --quiet --version 0.15.1 --target "${{ matrix.target }}" cargo-msrv
|
||||
- name: cargo-msrv verify melib MSRV
|
||||
if: success() || failure()
|
||||
run: |
|
||||
source "${HOME}/.cargo/env"
|
||||
cargo-msrv --output-format json --log-level trace --log-target stdout --path meli verify
|
||||
cargo-msrv --output-format json --log-level trace --log-target stdout --path melib verify
|
||||
- name: cargo-sort
|
||||
if: success() || failure()
|
||||
run: |
|
||||
source "${HOME}/.cargo/env"
|
||||
cargo-sort --check --check-format --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace fuzz
|
||||
cargo-sort --check --check-format --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace tools
|
||||
cargo-sort --check --check-format --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace --workspace
|
||||
- name: Check debian/changelog is up-to-date.
|
||||
if: success() || failure()
|
||||
run: |
|
||||
./scripts/check_debian_changelog.sh
|
|
@ -1,10 +1,11 @@
|
|||
name: Tests
|
||||
# SPDX-License-Identifier: EUPL-1.2
|
||||
name: Run Tests
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_NET_RETRY: 10
|
||||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
|
||||
RUSTFLAGS: "-D warnings -W unreachable-pub -W rust-2021-compatibility"
|
||||
RUSTFLAGS: "-D warnings -W unreachable-pub -W rust-2021-compatibility -C debuginfo=0"
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
RUST_BACKTRACE: short
|
||||
|
||||
|
@ -19,15 +20,6 @@ on:
|
|||
- 'meli/Cargo.toml'
|
||||
- 'Cargo.toml'
|
||||
- 'Cargo.lock'
|
||||
push:
|
||||
paths:
|
||||
- '.gitea/**'
|
||||
- 'melib/src/**'
|
||||
- 'melib/Cargo.toml'
|
||||
- 'meli/src/**'
|
||||
- 'meli/Cargo.toml'
|
||||
- 'Cargo.toml'
|
||||
- 'Cargo.lock'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
@ -43,12 +35,12 @@ jobs:
|
|||
rust: stable
|
||||
target: x86_64-unknown-linux-gnu
|
||||
steps:
|
||||
- uses: https://github.com/actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- id: os-deps
|
||||
name: install OS dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y libdbus-1-dev pkg-config mandoc libssl-dev
|
||||
apt-get install -y libdbus-1-dev pkg-config mandoc libssl-dev make
|
||||
#- id: cache-rustup
|
||||
# name: Cache Rust toolchain
|
||||
# uses: https://github.com/actions/cache@v3
|
||||
|
@ -56,14 +48,16 @@ jobs:
|
|||
# path: ~/.rustup
|
||||
# key: toolchain-${{ matrix.os }}-${{ matrix.rust }}
|
||||
#- if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }}
|
||||
- name: Install Rust ${{ matrix.rust }}
|
||||
uses: https://github.com/actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.rust }}
|
||||
components: clippy, rustfmt
|
||||
target: ${{ matrix.target }}
|
||||
override: true
|
||||
- id: rustup-setup
|
||||
name: Install rustup and toolchains
|
||||
shell: bash
|
||||
run: |
|
||||
if ! command -v rustup &>/dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
|
||||
source "${HOME}/.cargo/env"
|
||||
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
|
||||
rustup toolchain install --profile minimal ${{ matrix.rust }} --target ${{ matrix.target }}
|
||||
fi
|
||||
- name: Configure cargo data directory
|
||||
# After this point, all cargo registry and crate data is stored in
|
||||
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
|
||||
|
@ -86,9 +80,8 @@ jobs:
|
|||
target = "${{ matrix.target }}"
|
||||
EOF
|
||||
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
|
||||
name: Add lint dependencies
|
||||
name: Add test dependencies
|
||||
run: |
|
||||
cargo install --quiet --version 1.0.9 --target "${{ matrix.target }}" cargo-sort
|
||||
cargo install --quiet --version 0.9.54 --target "${{ matrix.target }}" cargo-nextest
|
||||
- name: cargo-check
|
||||
run: |
|
||||
|
@ -97,19 +90,14 @@ jobs:
|
|||
if: success() || failure()
|
||||
run: cargo test --all --no-fail-fast --all-features --no-run --locked
|
||||
- name: cargo test
|
||||
if: success() || failure() # always run even if other steps fail, except when cancelled <https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f>
|
||||
run: |
|
||||
cargo nextest run --all --no-fail-fast --all-features --future-incompat-report -E 'not (test(smtp::test::test_smtp))'
|
||||
#cargo test --all --no-fail-fast --all-features -- --nocapture --quiet
|
||||
- name: cargo-sort
|
||||
- name: rustdoc build
|
||||
if: success() || failure() # always run even if other steps fail, except when cancelled <https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f>
|
||||
run: |
|
||||
make build-rustdoc
|
||||
- name: rustdoc tests
|
||||
if: success() || failure()
|
||||
run: |
|
||||
cargo sort --check
|
||||
- name: rustfmt
|
||||
if: success() || failure()
|
||||
run: |
|
||||
cargo fmt --check --all
|
||||
- name: clippy
|
||||
if: success() || failure()
|
||||
run: |
|
||||
cargo clippy --no-deps --all-features --all --tests --examples --benches --bins
|
||||
make test-docs
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
# Build `meli`
|
||||
|
||||
For a quick start, build and install locally:
|
||||
|
||||
```sh
|
||||
PREFIX=~/.local make install
|
||||
```
|
||||
|
||||
Available subcommands for `make` are listed with `make help`.
|
||||
The Makefile *should* be POSIX portable and not require a specific `make` version.
|
||||
|
||||
`meli` requires rust version 1.68.2 or later and rust's package manager, Cargo.
|
||||
Information on how to get it on your system can be found here: <https://doc.rust-lang.org/cargo/getting-started/installation.html>
|
||||
|
||||
With Cargo available, the project can be built with `make` and the resulting binary will then be found under `target/release/meli`.
|
||||
Run `make install` to install the binary and man pages.
|
||||
This requires root, so I suggest you override the default paths and install it in your `$HOME`: `make PREFIX=${HOME}/.local install`.
|
||||
|
||||
You can build and run `meli` with one command: `cargo run --release`.
|
||||
|
||||
## Build features
|
||||
|
||||
Some functionality is held behind "feature gates", or compile-time flags. The following list explains each feature's purpose:
|
||||
|
||||
- `gpgme` enables GPG support via `libgpgme` (on by default)
|
||||
- `dbus-notifications` enables showing notifications using `dbus` (on by default)
|
||||
- `notmuch` provides support for using a notmuch database as a mail backend (on by default)
|
||||
- `jmap` provides support for connecting to a jmap server and use it as a mail backend (on by default)
|
||||
- `sqlite3` provides support for builting fast search indexes in local sqlite3 databases (on by default)
|
||||
- `cli-docs` includes the manpage documentation compiled by either `mandoc` or `man` binary to plain text in `meli`'s command line. Embedded documentation can be viewed with the subcommand `meli man [PAGE]` (on by default).
|
||||
- `regexp` provides experimental support for theming some e-mail fields based
|
||||
on regular expressions.
|
||||
It uses the `pcre2` library.
|
||||
Since it's actual use in the code is very limited, it is not recommended to use this (off by default).
|
||||
- `static` and `*-static` bundle C libraries in dependencies so that you don't need them installed in your system (on by default).
|
||||
|
||||
Though not a feature, the presence of the environment variable `UNICODE_REGENERATE_TABLES` in compile-time of the `melib` crate will force the regeneration of unicode tables.
|
||||
Otherwise the tables are included with the source code, and there's no real reason to regenerate them unless you intend to modify the code or update to a new Unicode version.
|
||||
|
||||
## Build Debian package (*deb*)
|
||||
|
||||
Building with Debian's packaged cargo might require the installation of these two packages: `librust-openssl-sys-dev librust-libdbus-sys-dev`
|
||||
|
||||
A `*.deb` package can be built with `make deb-dist`
|
||||
|
||||
## Using notmuch
|
||||
|
||||
To use the optional notmuch backend feature, you must have `libnotmuch5` installed in your system.
|
||||
In Debian-like systems, install the `libnotmuch5` packages.
|
||||
`meli` detects the library's presence on runtime.
|
||||
If it is not detected, you can use the `library_file_path` setting on your notmuch account to specify the absolute path of the library.
|
||||
|
||||
## Using GPG
|
||||
|
||||
To use the optional gpg feature, you must have `libgpgme` installed in your system.
|
||||
In Debian-like systems, install the `libgpgme11` package.
|
||||
`meli` detects the library's presence on runtime.
|
||||
|
||||
## Development
|
||||
|
||||
Development builds can be built and/or run with
|
||||
|
||||
```
|
||||
cargo build
|
||||
cargo run
|
||||
```
|
||||
|
||||
There is a debug/tracing log feature that can be enabled by using the flag `--feature debug-tracing` after uncommenting the features in `Cargo.toml`.
|
||||
The logs are printed in stderr when the env var `MELI_DEBUG_STDERR` is defined, thus you can run `meli` with a redirection (i.e `2> log`).
|
||||
|
||||
To trace network and protocol communications you can enable the following features:
|
||||
|
||||
- `imap-trace`
|
||||
- `jmap-trace`
|
||||
- `nntp-trace`
|
||||
- `smtp-trace`
|
606
CHANGELOG.md
606
CHANGELOG.md
|
@ -9,58 +9,559 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Added
|
||||
|
||||
- Added listing configuration setting `thread_subject_pack` (see meli.conf.5)
|
||||
- Added shortcuts for focusing to sidebar menu and back to the e-mail view (`focus_left` and `focus_right`)
|
||||
- `f76f4ea3` A new manual page, `meli.7` which contains a general tutorial for using meli.
|
||||
- `cbe593cf` add configurable header preample suffix and prefix for editing
|
||||
- `a484b397` Added instructions and information to error shown when libnotmuch could not be found.
|
||||
- `a484b397` Added configuration setting `library_file_path` to notmuch backend if user wants to specify the library's location manually.
|
||||
- `aa99b0d7` Implement configurable subject prefix stripping when replying
|
||||
- `a73885ac` added RGB support to embedded terminal emulator.
|
||||
- `f4e0970d` added ability to kill embed process with Ctrl-C, or Ctrl-Z and pressing 'q'.
|
||||
- `9205f3b8` added a per account mail sort order parameter.
|
||||
- `d921b3c3` implemented sorting with user sort order parameter if defined.
|
||||
- `dc5afa13` use osascript/applescript for notifications on macos
|
||||
- `d0de0485` add {in,de}crease_sidebar shortcuts
|
||||
- `340d6451` add config setting for sidebar ratio
|
||||
- `36e29cb6` Add configurable mailbox sort order
|
||||
- `7606317f` melib/notmuch: add support for virtual mailbox hierarchy
|
||||
Add optional `parent` property to notmuch mailbox configuration.
|
||||
- `d9c07def` Add command to select charset encoding for email
|
||||
Open dialog to select charset with `d`.
|
||||
- `d679a744` melib/jmap: Implement Bearer token authentication
|
||||
Fastmail now uses an API token in a http header for authentication.
|
||||
This can be used either as a server_password or provided by a
|
||||
`server_password_command` like oauth2.
|
||||
- `47e6d5d9` add edit-config CLI subcommand that opens config files on `EDITOR`
|
||||
- `8c671935` Add compose (pre-submission) hooks for validation/linting
|
||||
compose-hooks run before submitting an e-mail.
|
||||
They perform draft validation and/or transformations.
|
||||
If a hook encounters an error or warning, it will show up as a notification.
|
||||
The currently available hooks are:
|
||||
- `past-date-warn`
|
||||
Warn if Date header value is far in the past or future.
|
||||
- `important-header-warn`
|
||||
Warn if important headers (From, Date, To, Cc, Bcc) are missing or invalid.
|
||||
- `missing-attachment-warn`
|
||||
Warn if Subject, draft body mention attachments but they are missing.
|
||||
- `empty-draft-warn`
|
||||
Warn if draft has no subject and no body.
|
||||
|
||||
They can be disabled with `[composing.disabled_compose_hooks]` setting.
|
||||
- `e9cd800f` Added support for storing flags locally for NNTP accounts.
|
||||
- Added options to show relative row numbers in menus and listings to make jumping easier.
|
||||
`[listing.relative_menu_indices]` and `[listing.relative_list_indices]`.
|
||||
|
||||
### Changed
|
||||
|
||||
- `f76f4ea3` Shortcut `open_thread` and `exit_thread` renamed to `open_entry` and `exit_entry`.
|
||||
- `7650805c` Binary size reduced significantly.
|
||||
- [0e3a0c4b](https://git.meli-email.org/meli/meli/commit/0e3a0c4b7049139994a65c6fe914dd3587c6713e) Add safe UI widget area drawing API
|
||||
- [0114e695](https://git.meli-email.org/meli/meli/commit/0114e695428579ef4461b289d7372e3b392b5e62) Add next_search_result and previous_search_result shortcuts
|
||||
- [c4344529](https://git.meli-email.org/meli/meli/commit/c4344529e30b3385149d6dc3c1c4b34306a85491) Add .git-blame-ignore-revs file
|
||||
|
||||
### Fixed
|
||||
|
||||
- `a42a6ca8` show notifications in terminal if there is no other alternative.
|
||||
- `6086a3789d` Fix libgpgme segfault error and re-enable gpg features.
|
||||
- [bcec745c](https://git.meli-email.org/meli/meli/commit/bcec745c241d7ed5d7d455ccdd65c6c95e1862b0) Fix command and status bar drawing
|
||||
- [62b8465f](https://git.meli-email.org/meli/meli/commit/62b8465f2cd99789576d70008f1f321243b81fc3) Fix ThreadView for new TUI API
|
||||
- [28fa66cc](https://git.meli-email.org/meli/meli/commit/28fa66cc2ad05e67708377fc99ffd65aa1b14386) Fix ThreadedListing for new TUI API
|
||||
- [2c6f180d](https://git.meli-email.org/meli/meli/commit/2c6f180df987976c1f4cba7ceac878e697c73d27) Fix macos compilation
|
||||
- [24971d19](https://git.meli-email.org/meli/meli/commit/24971d1960418bad92d89af9eb744933445baf99) Fix compilation with 1.70.0 cargo
|
||||
|
||||
### Changed
|
||||
|
||||
- [a1cbb198](https://git.meli-email.org/meli/meli/commit/a1cbb1988b34951046045f724f52bed2925b3880) Return Results instead of panicking
|
||||
- [7645ff1b](https://git.meli-email.org/meli/meli/commit/7645ff1b875e3920389567eb5e61d800291e8a27) Rename write_string{to_grid,}
|
||||
- [c2ae19d1](https://git.meli-email.org/meli/meli/commit/c2ae19d1208f2eb5cca341a04e019c3e285637a8) Return Option from current_pos
|
||||
- [b61fc3ab](https://git.meli-email.org/meli/meli/commit/b61fc3ab6482dcef4f5cc1c09db3539b7e401f78) Add HelpView struct for shortcuts widget
|
||||
- [ba7a97e9](https://git.meli-email.org/meli/meli/commit/ba7a97e90b4c474299a7b12fa74b7ea06c1535c8) Add x axis scroll support
|
||||
- [3495ffd6](https://git.meli-email.org/meli/meli/commit/3495ffd61b5888f8538304ecb6e441819b373bdc) Change UIEvent::Notification structure
|
||||
- [ccf6f9a2](https://git.meli-email.org/meli/meli/commit/ccf6f9a26e95437fb24464f90736c653e3f5dfed) Remember previous `set [index_style]]` preferences
|
||||
- [23c15261](https://git.meli-email.org/meli/meli/commit/23c15261e79c63791c569f225c1745df1b90ce2d) Abstract envelope view filters away
|
||||
- [031d0f7d](https://git.meli-email.org/meli/meli/commit/031d0f7dc76700ac938e1ee4a767fab8deebb9f2) Add area.is_empty() checks in cell iterators
|
||||
- [e37997d6](https://git.meli-email.org/meli/meli/commit/e37997d697f1f0b8faaa56a36f43c9f1da4bbb41) Store Link URL value in Link type
|
||||
|
||||
### Refactoring
|
||||
|
||||
- [0500e451](https://git.meli-email.org/meli/meli/commit/0500e451dab5f129d71a9279913531e77981e868) Add missing EnvelopeRemove event handler
|
||||
- [ab14f819](https://git.meli-email.org/meli/meli/commit/ab14f81900a03a07ef00a6b3232cb29d78e8edf5) Make write_string_to_grid a CellBuffer method
|
||||
- [e0adcdfe](https://git.meli-email.org/meli/meli/commit/e0adcdfe15b8a78c333de199ba734a83181f53be) Move rest of methods under CellBuffer
|
||||
- [0a74c7d0](https://git.meli-email.org/meli/meli/commit/0a74c7d0e5c318dd29c8ace01e588d441e0fcfb6) Overhaul refactor
|
||||
- [3b4acc15](https://git.meli-email.org/meli/meli/commit/3b4acc15a535c9bfd084b2e33f2cd00b5b5d4eb0) Add tests
|
||||
- [7eedd860](https://git.meli-email.org/meli/meli/commit/7eedd860518e3f7f5000a1888e4fa58ddbfb43bc) Remove address_list! macro
|
||||
- [f3e85738](https://git.meli-email.org/meli/meli/commit/f3e85738e7981755e96468213c02af78432f8cdd) Move build.rs scripts to build directory
|
||||
- [77325486](https://git.meli-email.org/meli/meli/commit/773254864bd8436712905eeb0c725d1d05277e60) Remove on-push hooks for actions w/ run on-pr
|
||||
|
||||
### Documentation
|
||||
|
||||
- [d018f07a](https://git.meli-email.org/meli/meli/commit/d018f07aa51fc293bf696fa7d7beff8e59ac91a8) Retouch manual pages
|
||||
- [3adba40e](https://git.meli-email.org/meli/meli/commit/3adba40e32a8a66271ea2a8f5ddf27858744ecd6) Add macos manpage mirror url
|
||||
|
||||
### Packaging
|
||||
|
||||
- [cd2ba80f](https://git.meli-email.org/meli/meli/commit/cd2ba80f8e5424be08421b4dcc5113977418f240) Update metadata
|
||||
- [5f8d7c80](https://git.meli-email.org/meli/meli/commit/5f8d7c8039c0623b3950fd1a8eb566f943fc309d) Update deb-dist target command with author metadata
|
||||
- [59c99fdc](https://git.meli-email.org/meli/meli/commit/59c99fdc79bb31fb42cb99d4b95613022396a499) Update debian package metadata
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- [6506fffb](https://git.meli-email.org/meli/meli/commit/6506fffb9427ba13ba4368cd6b2c0dba12e5294c) Rewrite email flag modifications
|
||||
- [23507932](https://git.meli-email.org/meli/meli/commit/23507932f94257a71f2ca8db23840ee0716072b6) Update cache on set_flags
|
||||
- [470cae6b](https://git.meli-email.org/meli/meli/commit/470cae6b885c9b4851195fbb8274b1663bfa75cb) Update thread cache on email flag modifications
|
||||
- [c1c41c91](https://git.meli-email.org/meli/meli/commit/c1c41c9126005266f00d4979777718463dddf7b2) Update README.md and add Codeberg mirror
|
||||
- [84f3641e](https://git.meli-email.org/meli/meli/commit/84f3641ec1401a0522811add0ed87a131be449b9) Re-add on-screen message display
|
||||
- [54d21f25](https://git.meli-email.org/meli/meli/commit/54d21f25fdb716d36fd3678dd149eb880e16698d) Re-add contact list and editor support
|
||||
- [458258e1](https://git.meli-email.org/meli/meli/commit/458258e1aab91f3883d6a9201a175462511349e9) Re-enable compact listing style
|
||||
- [1c1be7d6](https://git.meli-email.org/meli/meli/commit/1c1be7d6c9bfc9f14c3a62ce464e1e15f2e6c4ec) Add display_name(), display_slice(), display_name_slice() methods
|
||||
- [5dd71ef1](https://git.meli-email.org/meli/meli/commit/5dd71ef1cd93aebaadb0554eac692d0a0fa4aecd) Upgrade JobsView component to new TUI API
|
||||
- [b5cc2a09](https://git.meli-email.org/meli/meli/commit/b5cc2a095f0268bb90cab150e903b0bbaffe1479) Upgrade MailboxManager component to new TUI API
|
||||
- [ed8a5de2](https://git.meli-email.org/meli/meli/commit/ed8a5de2cb4b93ad766803d3590f7041f28cc419) Re-enable EditAttachments component
|
||||
- [77a8d9e2](https://git.meli-email.org/meli/meli/commit/77a8d9e2c2094e84e06f5d624cb6f8afda24a400) Make ModSequence publicly accessible
|
||||
- [64898a05](https://git.meli-email.org/meli/meli/commit/64898a0583e348fef3cd266a7196425e7015a871) Make UIDStore constructor pub
|
||||
- [10c3b0ea](https://git.meli-email.org/meli/meli/commit/10c3b0eabe1684699c775e03c4c58038ea7979af) Bump version to 0.8.5-rc.1
|
||||
- [71f3ffe7](https://git.meli-email.org/meli/meli/commit/71f3ffe740276087f20d85d62440ef5d3fe426f6) Update Makefile
|
||||
- [63a63253](https://git.meli-email.org/meli/meli/commit/63a63253d77f6e1b9a42ec55ecf0bbc45a011245) Use type alias for c_char
|
||||
- [c751b2e8](https://git.meli-email.org/meli/meli/commit/c751b2e8450aa83b7a8f5e8afbeccadf333f74ba) Re-enable conversations listing style
|
||||
- [d16afc7d](https://git.meli-email.org/meli/meli/commit/d16afc7d8d9e2eddb81664673e9a4ef82da2e303) Bump version to 0.8.5-rc.2
|
||||
- [da251455](https://git.meli-email.org/meli/meli/commit/da251455a0185e207e0ec2d51273f6ddbdb572a8) Bump meli version to 0.8.5-rc.2
|
||||
- [3a709794](https://git.meli-email.org/meli/meli/commit/3a7097948308981204132a0eed2d28338f9d6b33) Update minimum rust version from 1.65.0 to 1.68.2
|
||||
- [f900dbea](https://git.meli-email.org/meli/meli/commit/f900dbea468e822c5a510a72ecc6367549443927) Use cargo-derivefmt to sort derives alphabetically
|
||||
- [5ff4e8ae](https://git.meli-email.org/meli/meli/commit/5ff4e8ae68182db8d4535d8537d26a3f398c815b) Run builds.yaml when any manifest file changes
|
||||
- [0a617410](https://git.meli-email.org/meli/meli/commit/0a617410ec1ce5f6fb43772e4ad43f45f58a7f4d) Split test.yaml to test.yaml and lints.yaml
|
||||
- [3ba1603a](https://git.meli-email.org/meli/meli/commit/3ba1603af2a9e408659717b9c8dace7406a8b142) Add manifest file only lints workflow
|
||||
- [1617212c](https://git.meli-email.org/meli/meli/commit/1617212c5b0948174155ece4a9d0584764bd7dac) Add scripts/check_debian_changelog.sh lint
|
||||
- [e19f3e57](https://git.meli-email.org/meli/meli/commit/e19f3e572c0ac585a6c2023e50f8fd0bd2ea2dae) Cargo-sort all Cargo.toml files
|
||||
- [c41f35fd](https://git.meli-email.org/meli/meli/commit/c41f35fdd55bf093656b68cc69eab4cf4b9a8ec4) Use actions/checkout@v3
|
||||
- [876616d4](https://git.meli-email.org/meli/meli/commit/876616d45b7798131ecdda82bb90d1d481842f5c) Use actions/upload-artifact@v3
|
||||
- [2419f4bd](https://git.meli-email.org/meli/meli/commit/2419f4bd40fb1a732cf1df42dde48ba8ca812072) Add debian package build workflow
|
||||
|
||||
## [v0.8.4](https://git.meli-email.org/meli/meli/releases/tag/v0.8.4) - 2023-11-22
|
||||
|
||||
### Fixed
|
||||
|
||||
- [ef30228e](https://git.meli-email.org/meli/meli/commit/ef30228e08efe6e36ab9858a5ba32876d6d8fdae) Fix failing test
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- [f81a1e23](https://git.meli-email.org/meli/meli/commit/f81a1e23382208390394be71e3aaa27ee505cb0f) Bump version to 0.8.4
|
||||
|
||||
## [v0.8.3](https://git.meli-email.org/meli/meli/releases/tag/v0.8.3) - 2023-11-22
|
||||
|
||||
### Added
|
||||
|
||||
- [3105a037](https://git.meli-email.org/meli/meli/commit/3105a0373b8754f37b326239c1cf7129fae06e1b) Add quit command
|
||||
|
||||
### Fixed
|
||||
|
||||
- [d3cbf184](https://git.meli-email.org/meli/meli/commit/d3cbf184e606d5b7ade9cfb125db01f45d7180ae) Add extra_submission_headers fields in composer form and autocomplete for Newsgroups
|
||||
- [7aec5b8e](https://git.meli-email.org/meli/meli/commit/7aec5b8e78d80e7717a9aedd7344db6b108534f5) Fix SMTP example doc
|
||||
- [f702dc22](https://git.meli-email.org/meli/meli/commit/f702dc220c9ab97ce0fddfae194d5e2935a20193) Fix new clippy lints.
|
||||
- [688e39a6](https://git.meli-email.org/meli/meli/commit/688e39a67e6a467ca649acbe20b1f368fbc1e9f0) Fix clippy lints
|
||||
|
||||
### Changed
|
||||
|
||||
- [5a7919bb](https://git.meli-email.org/meli/meli/commit/5a7919bb03641be6d7bc5b9002d44e16ee358f12) Use ConversationsListing::format_date
|
||||
- [0f3b5294](https://git.meli-email.org/meli/meli/commit/0f3b52945959b53c8d809eb434a91ec4c561b2d4) Hoist format_date() to ListingTrait method
|
||||
|
||||
### Refactoring
|
||||
|
||||
- [e1b55340](https://git.meli-email.org/meli/meli/commit/e1b55340fa258a2a7b118fd18c11614fb2b5e173) Show error description when TIOCGWINSZ ioctl fails
|
||||
- [e95c275d](https://git.meli-email.org/meli/meli/commit/e95c275d68fe3dbd588046c110ae8b3fa966f6de) Remove duplicate end sequence
|
||||
- [8a21be21](https://git.meli-email.org/meli/meli/commit/8a21be21775cb474a6b65e1c0bffd771c0df6f2f) Replace splice with truncate
|
||||
- [2db021fa](https://git.meli-email.org/meli/meli/commit/2db021fa0a9a707cd7cdb6c8bf140bf5c8acf906) Remove regexp from default features
|
||||
- [fa33a946](https://git.meli-email.org/meli/meli/commit/fa33a9468a16c50361353efa269fca79bd58e284) Move managesieve-client binary to tools/
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- [e88957ae](https://git.meli-email.org/meli/meli/commit/e88957ae6edfee7fabb41e9210f9d906866cda8d) Add extra_submission_headers field in MailBackendCapabilities struct
|
||||
- [606f487f](https://git.meli-email.org/meli/meli/commit/606f487fc5e227f1727697a5911e27cbec174089) Add IRC channel badge
|
||||
- [0e60bdf2](https://git.meli-email.org/meli/meli/commit/0e60bdf26eb842744f59257800ca8e30b1a43836) Add "iterator" feature to signal-hook
|
||||
- [ac2a5dcd](https://git.meli-email.org/meli/meli/commit/ac2a5dcdd10d97f5ed9c8a8c83e1641b373dd31a) Add display() method for Address
|
||||
- [43bfd413](https://git.meli-email.org/meli/meli/commit/43bfd4131d5cab39319d1943bcad46e929ec4d56) Update ahash dependency
|
||||
- [af241d25](https://git.meli-email.org/meli/meli/commit/af241d25cbab20227a88ec4d557222cdeed98dde) Bump version to 0.8.3
|
||||
- [7387b67e](https://git.meli-email.org/meli/meli/commit/7387b67eeee27aefbc4d20ca2a1d503aa0fb1838) Enable "static" build for C library dependencies by default
|
||||
- [bfc78a08](https://git.meli-email.org/meli/meli/commit/bfc78a0803524e236bc883833838d3ad78918621) Replace CRLF with LF when editing
|
||||
- [111a1160](https://git.meli-email.org/meli/meli/commit/111a1160adf2e0fef00a90350784307c859a198b) Bump version to 0.8.3
|
||||
|
||||
## [v0.8.2](https://git.meli-email.org/meli/meli/releases/tag/v0.8.2) - 2023-09-22
|
||||
|
||||
### Fixed
|
||||
|
||||
- [73b3ed55](https://git.meli-email.org/meli/meli/commit/73b3ed559d21dcc7cdee7f96119461e2447c1906) Fix forward dialog not workng
|
||||
- [7888d8b2](https://git.meli-email.org/meli/meli/commit/7888d8b2a5dc977f0f18094a32dc73893a5cfc4f) Fix doc test compilation
|
||||
|
||||
### Changed
|
||||
|
||||
- [22525d40](https://git.meli-email.org/meli/meli/commit/22525d40fb48661f86657151e35fdf9c95c4b45e) Go to end when pressing next/page down for the second time
|
||||
- [71474436](https://git.meli-email.org/meli/meli/commit/714744366f5e26fc1b6609e8e785d64489f9a68d) Revert 22525d40 behavior when sidebar not focused
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- [eb5d49c4](https://git.meli-email.org/meli/meli/commit/eb5d49c41ac58c5068011620c22e21b5fa115417) Use Self in self methods
|
||||
- [3d85ca2e](https://git.meli-email.org/meli/meli/commit/3d85ca2edfca9abff4b3ffdd837b25e68c6586c2) Bump version to 0.8.2
|
||||
|
||||
## [v0.8.1](https://git.meli-email.org/meli/meli/releases/tag/v0.8.1) - 2023-09-13
|
||||
|
||||
### Added
|
||||
|
||||
- [6476985c](https://git.meli-email.org/meli/meli/commit/6476985ce6abbb9048ba5aec19f6c5144bfe89b7) Add Cross.toml for aarch64-unknown-linux-gnu builds
|
||||
- [45d4f611](https://git.meli-email.org/meli/meli/commit/45d4f611b170d7b80afca5810c51fea1bf084c10) Add install-man cli subcommand to install manpages on your system
|
||||
- [a4f0dbac](https://git.meli-email.org/meli/meli/commit/a4f0dbac26126c03886115e518b3cd2ede0b88cb) Add current working directory tracking to Context
|
||||
|
||||
### Fixed
|
||||
|
||||
- [49a38a23](https://git.meli-email.org/meli/meli/commit/49a38a23bf522a18e636385632cfe3533c4f525c) Fix invalid Type link references
|
||||
- [85af5244](https://git.meli-email.org/meli/meli/commit/85af524458bc06421ac39689469474efb8164c1c) Fix invalid mailto() results when body field exists
|
||||
- [c7825c76](https://git.meli-email.org/meli/meli/commit/c7825c76c3ac6be89f64f1f04afd9c0ca08bdf76) Handle dialog Esc in the parent component
|
||||
- [dd4d0b79](https://git.meli-email.org/meli/meli/commit/dd4d0b79721d8cd5b29cdaca9cd01412974f2e13) Fix typo
|
||||
- [c43aeb0e](https://git.meli-email.org/meli/meli/commit/c43aeb0eb103f2a8fd802f84eab56551c6e65418) Fix invalid address parse on folded values
|
||||
- [7e3e9386](https://git.meli-email.org/meli/meli/commit/7e3e9386316ef344580d9e44edb3f8b0c196c3c5) Fix out-of-bounds draw when terminal is small
|
||||
- [7e4ed2fa](https://git.meli-email.org/meli/meli/commit/7e4ed2fa107eca2ef309bcaa211440c315730b6c) Fix some out of bounds drawing.
|
||||
|
||||
### Changed
|
||||
|
||||
- [1b3bebe3](https://git.meli-email.org/meli/meli/commit/1b3bebe3049ae5c7cb2210ed95c355c9b5c709f8) Open earliest unread email instead of first in thread
|
||||
- [49c36009](https://git.meli-email.org/meli/meli/commit/49c36009cec8c88d61d796162787990216bfeeab) Don't initialize entire thread at once
|
||||
- [0a9c89b6](https://git.meli-email.org/meli/meli/commit/0a9c89b6b357fc3d002c3eb451fd67e7a49ce7f5) Add toggle_layout shortcut
|
||||
- [64ba0459](https://git.meli-email.org/meli/meli/commit/64ba0459ee3652eaf451d10222853a898d85e337) Init cursor at To: header field
|
||||
- [81974311](https://git.meli-email.org/meli/meli/commit/81974311c200b8ad66c0e626f8b8db6686e565ff) Show current number command buffer
|
||||
|
||||
### Refactoring
|
||||
|
||||
- [a337e226](https://git.meli-email.org/meli/meli/commit/a337e2269e584769314cdf325cdeb6e57cb0c622) Refactor module structure
|
||||
- [b4f2f335](https://git.meli-email.org/meli/meli/commit/b4f2f3357613729e493e5f41a48def7610dc65aa) Remove deflate feature; make it a hard dependency
|
||||
- [2dc29405](https://git.meli-email.org/meli/meli/commit/2dc29405868b9df0dfff25e341814526a478db00) Add feature to use cache instead of downloading unicode data
|
||||
- [0132677f](https://git.meli-email.org/meli/meli/commit/0132677ff54a9618d3c59b08a188b73ae0c062c7) Introduce CommandError with context
|
||||
- [3344a8db](https://git.meli-email.org/meli/meli/commit/3344a8dbf6b478a85d2b933fc1fa1a6001c600f4) Remove unnecessary Clone derives
|
||||
- [b673af02](https://git.meli-email.org/meli/meli/commit/b673af02ac9e9d4be95daa2490ce24d0bc9b10d9) Move to crate root
|
||||
- [54862f86](https://git.meli-email.org/meli/meli/commit/54862f8651cb7dfe3bca7f5924fe776b93ac6aee) Add hide_sidebar_on_launch option
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- [a615b470](https://git.meli-email.org/meli/meli/commit/a615b4701b7e852a9112b317e2e31997c6cbe82e) Embed xdg-utils crate
|
||||
- [f0075b86](https://git.meli-email.org/meli/meli/commit/f0075b86cf636a3d39d4edf1ff6d58c112bbecf7) Show descriptive tab names for composer and threads
|
||||
- [6d5ebb5b](https://git.meli-email.org/meli/meli/commit/6d5ebb5b04279fe6e4fbf598504cae2f012fa494) Split code into submodules, add better error reporting
|
||||
- [63abf1e8](https://git.meli-email.org/meli/meli/commit/63abf1e890b93fcadf35f88b3dbea473c0d8f5cd) Update README.md
|
||||
- [bb4d2000](https://git.meli-email.org/meli/meli/commit/bb4d20003690d72b62a66d46a1fc5ae914e2bf64) Unify toggle_* parsers
|
||||
- [9b9c38f7](https://git.meli-email.org/meli/meli/commit/9b9c38f769abae0ff86e4b71e4db0ad65fdacfb4) Don't flood user with sqlite3 errors if db is corrupted
|
||||
- [747e39bf](https://git.meli-email.org/meli/meli/commit/747e39bf55cfc19b6eeece3ca7c71bad98d92389) Add print-used-paths subcommand
|
||||
- [39e99770](https://git.meli-email.org/meli/meli/commit/39e99770da4b51d0986a4b561fbe36b27d04565d) Use Context::current_dir() when saving files to relative paths
|
||||
- [fe0a96f0](https://git.meli-email.org/meli/meli/commit/fe0a96f0855486207280430064a93cab94dffeb2) Update to 2021 edition
|
||||
- [3944e4e6](https://git.meli-email.org/meli/meli/commit/3944e4e60e431247eefc0b3cf35af27fb011f37b) Update to 2021 edition
|
||||
- [7eed8278](https://git.meli-email.org/meli/meli/commit/7eed82783a3dbac513e233be4f0bce06904fe8c8) Bump version to 0.8.1
|
||||
|
||||
## [v0.8.0](https://git.meli-email.org/meli/meli/releases/tag/v0.8.0) - 2023-08-29
|
||||
|
||||
### Added
|
||||
|
||||
- [36e29cb6](https://git.meli-email.org/meli/meli/commit/36e29cb6fd00c798ad83e3064e0ff78c8153dced) Add configurable mailbox sort order
|
||||
- [81184b18](https://git.meli-email.org/meli/meli/commit/81184b182c5f5d65614653b817981fddc6a84ffa) Add extra_identities configuration flag
|
||||
- [b716e438](https://git.meli-email.org/meli/meli/commit/b716e4383ea3163cabe760cd5512b7d70b218915) Add collapse option for mailboxes in sidebar menu
|
||||
- [3d92b410](https://git.meli-email.org/meli/meli/commit/3d92b41075fc16214675cf141acd9c89fb6f5c49) Add cli-docs feature to the default set
|
||||
- [104352e5](https://git.meli-email.org/meli/meli/commit/104352e5950598f4a659bd593d587910af8adc12) Add table UI widget
|
||||
- [7d9cabb0](https://git.meli-email.org/meli/meli/commit/7d9cabb023b510e6175fd6b2523f0414a6da1f3f) Add mailbox manager tab
|
||||
- [660bacb9](https://git.meli-email.org/meli/meli/commit/660bacb9262dac7457bd8c421cc70343a0db3cd5) Add `mailto` command to open composer with initial values from mailto template
|
||||
- [3adf72ae](https://git.meli-email.org/meli/meli/commit/3adf72aed0772fea39fbd6cbaec680fb2995e92d) Add support for utf-7 encoding
|
||||
- [d9c07def](https://git.meli-email.org/meli/meli/commit/d9c07def0f5db655aa11c5981d1419a336c3d91a) Add command to select charset encoding for email
|
||||
- [8c671935](https://git.meli-email.org/meli/meli/commit/8c671935f9ad5bd2894c0ecdaec9c2f378e461ca) Add compose (pre-submission) hooks for validation/linting
|
||||
- [96537e48](https://git.meli-email.org/meli/meli/commit/96537e48c5f5c8d54076ec5db76e94a499cbe1e6) Add {Timer,Component}Id wrapper types over Uuid
|
||||
- [b5f205b7](https://git.meli-email.org/meli/meli/commit/b5f205b77b8911a1fb6019767bb026e5f4a7f79e) Add availability to use server_password_command in the nntp backend like in the IMAP backend
|
||||
- [a5770c89](https://git.meli-email.org/meli/meli/commit/a5770c89f46b908d17d6eb4573c8337a952f99a8) Add Woodpecker-CI check pipeline
|
||||
- [d4e605c0](https://git.meli-email.org/meli/meli/commit/d4e605c098ba13b8bc2d9f14d07ea45da38e9a2f) Add tagref source code annotations
|
||||
- [cf9a04a5](https://git.meli-email.org/meli/meli/commit/cf9a04a5910c9d82e1acb10a2f4d40c2af0335ed) Add metadata to Jobs, and add JobManager tab
|
||||
- [bb7e119a](https://git.meli-email.org/meli/meli/commit/bb7e119ade131e8fe1bcac39b616741af817808c) Add gitea CI workflows
|
||||
- [1c79786e](https://git.meli-email.org/meli/meli/commit/1c79786ea210e53ee7d566455d83d74fe4699d28) Add scripts/make_html_manual_page.py
|
||||
- [65e82d88](https://git.meli-email.org/meli/meli/commit/65e82d8896500e8ef586656e3bde4bc102b84aba) Add meli/README.md symbolic link
|
||||
|
||||
### Fixed
|
||||
|
||||
- [ce2068d3](https://git.meli-email.org/meli/meli/commit/ce2068d36bb5d8ad0bb8f886bc19cb4aab75c4e8) Fix background watch using JSON paths incorrectly
|
||||
- [e9aaa7b0](https://git.meli-email.org/meli/meli/commit/e9aaa7b067903040acd7f3d7c685de94b3b98450) Use *const c_char instead of *const i8 for portability
|
||||
- [aa3524dd](https://git.meli-email.org/meli/meli/commit/aa3524dd305f2cf293eaaf7120b812478255f79c) Fix tag not being removed in set_flags()
|
||||
- [daa900ec](https://git.meli-email.org/meli/meli/commit/daa900ec9a566460833c020feba10933c0248162) Fix embed terminal in macos
|
||||
- [7fca5f01](https://git.meli-email.org/meli/meli/commit/7fca5f01ef53069958403dd794ee0e5c310f4e45) Fix jmap build with isahc 1.7.2
|
||||
- [ed3dbc85](https://git.meli-email.org/meli/meli/commit/ed3dbc85861ab61fee56077c7ba94306b0a96dc4) Fix crashes when listing is empty
|
||||
- [824f614a](https://git.meli-email.org/meli/meli/commit/824f614a69e55a25d67832593cb8aadb9671e306) Fix HtmlView not being redrawn when parent is dirty
|
||||
- [97ff3e78](https://git.meli-email.org/meli/meli/commit/97ff3e787fbfb5ff50e3ba787f067829509f7cd2) Only add toml files to the themes
|
||||
- [9cb66ef8](https://git.meli-email.org/meli/meli/commit/9cb66ef818f6598eb779f931e201a8d38e86a484) Fix all clippy warnings in `meli` crate
|
||||
- [0c0bee44](https://git.meli-email.org/meli/meli/commit/0c0bee4482d4fbfa675b97ca30405fdc77655936) Add missing .PHONY targets, fix missing tab indentation
|
||||
- [a73885ac](https://git.meli-email.org/meli/meli/commit/a73885acb14cd94d4a6a54ebd5b39a001d7e21e1) Improve embed terminal
|
||||
- [da9c80cc](https://git.meli-email.org/meli/meli/commit/da9c80ccfd7aa87842c2c3c089ba2b784a583ab6) Enhance SubjectPrefix with strip_prefixes_from_list() method
|
||||
- [aa99b0d7](https://git.meli-email.org/meli/meli/commit/aa99b0d787463be4267913b801117bd4d2ea5003) Implement configurable subject prefix stripping when replying
|
||||
- [cbe593cf](https://git.meli-email.org/meli/meli/commit/cbe593cf31308dcf549d7880eea2d82e5024dd73) Add configurable header preample suffix and prefix for editing
|
||||
- [2de69d17](https://git.meli-email.org/meli/meli/commit/2de69d17f14e79ce2a35564d278b5e895d16a48f) Fix erroneous placement of newlnes for wrap_header_preamble suffix
|
||||
- [94bd84b4](https://git.meli-email.org/meli/meli/commit/94bd84b45d53b0e0fae52198fbdc05179b87cccc) Fix clippy lints for `meli` crate
|
||||
- [b138d9bc](https://git.meli-email.org/meli/meli/commit/b138d9bc6166b763febf035b50109d810e3c18c9) Fix some clippy lints
|
||||
- [c6bdda03](https://git.meli-email.org/meli/meli/commit/c6bdda03cf451ab52a3d414cad1344bb32c82879) Fix notmuch error shown on any missing backend
|
||||
- [16646976](https://git.meli-email.org/meli/meli/commit/16646976d75284665c1fa0d7b7e3e3cde3531d66) Fix reply subject prefixes stripping original prefix
|
||||
- [88a1f0d4](https://git.meli-email.org/meli/meli/commit/88a1f0d4bc17b60f8f23ea71f33a81aee78f8769) Fix FETCH response parsing bug
|
||||
- [59b95f83](https://git.meli-email.org/meli/meli/commit/59b95f83d2b388b30a3a855f68bf5952355597d7) Fix docs
|
||||
- [282af86e](https://git.meli-email.org/meli/meli/commit/282af86e83807772f042b115af24ffe2e0575b9e) Fix NAME sections manual pages for correct whatis(1) parsing
|
||||
- [bd22f986](https://git.meli-email.org/meli/meli/commit/bd22f986f0c06f6dae535733d484aa89f610ed46) Fix clippy lints
|
||||
- [5ba7b2cd](https://git.meli-email.org/meli/meli/commit/5ba7b2cd7bb07abe8faafe5e45db6145b3f90bc9) Fix clippy lints for meli binary
|
||||
- [7924aa8b](https://git.meli-email.org/meli/meli/commit/7924aa8bfe8f0fbcd557bb8bb3a9d3ebeab2220a) Fix compilation
|
||||
- [b9030a68](https://git.meli-email.org/meli/meli/commit/b9030a684c0ad64951a388e49d5825c12b483fb4) Fix selection not appearing immediately and invalid motions
|
||||
- [4f45b109](https://git.meli-email.org/meli/meli/commit/4f45b109745ebc29febc452b9bcb0cd88f131ffc) Fix tag updates not showing up right away
|
||||
- [abc56eae](https://git.meli-email.org/meli/meli/commit/abc56eae431153d2e48f8b1eb3e0d2a140b600d8) Fix SEEN flag update hiding mail view momentarily
|
||||
- [40c6647d](https://git.meli-email.org/meli/meli/commit/40c6647db83c5137b79c9bec233972a8a78aeb76) Fix multipart/related with main text/html part not displayed correctly
|
||||
- [11140b4a](https://git.meli-email.org/meli/meli/commit/11140b4a76419a6f8c83db38823e83aeac8fbb98) Fix test output
|
||||
- [3a10953f](https://git.meli-email.org/meli/meli/commit/3a10953f05ea4944a8a20c2c5d647d5862dca907) Update fix-prefix-for-debian.patch
|
||||
- [939dc15e](https://git.meli-email.org/meli/meli/commit/939dc15e289e06a0fad72e44f9e91133892a4ec0) Fix melib tests
|
||||
- [39d9c2af](https://git.meli-email.org/meli/meli/commit/39d9c2af3b7daf39c6aa7eab5f2d95f1b9c3a562) Fix test smtp server logic
|
||||
- [34bb532e](https://git.meli-email.org/meli/meli/commit/34bb532e8d91c5f35bdc058821da63ac543ecfa6) Mention w3m dependency
|
||||
- [b1a71887](https://git.meli-email.org/meli/meli/commit/b1a71887710153f0f98b25b2f224fbe37f7a6889) Clippy fixes
|
||||
- [1f8ac228](https://git.meli-email.org/meli/meli/commit/1f8ac2287b960e0ed5c44dadbf68b924f035d321) Fix ftplugin location and add example mail.vim file
|
||||
- [1eea8bab](https://git.meli-email.org/meli/meli/commit/1eea8bab77cc20fb911f13aa16322a217b36b06b) Fix `test_imap_fetch_response`.
|
||||
- [daf42fd4](https://git.meli-email.org/meli/meli/commit/daf42fd456bad5ddf65ac515c2fb277896d1fea3) Fix build error with quote 1.0.28
|
||||
- [6388bea9](https://git.meli-email.org/meli/meli/commit/6388bea9a063f776398ffc503fdb0789ce9af9f1) Fix &[u8] index in HeaderMap
|
||||
- [c5ecacea](https://git.meli-email.org/meli/meli/commit/c5ecaceae1ab50a1c337f5cab9e97c0b061cb2d5) Fix some search criteria in Query type
|
||||
- [27a4dcb9](https://git.meli-email.org/meli/meli/commit/27a4dcb916e0bed723490df9d82bfd7c83f10a83) Fix some rustdoc lints
|
||||
- [fdc0861a](https://git.meli-email.org/meli/meli/commit/fdc0861ac0ac725e6e5031d120bd4682752c0267) Fix expanded_hash argument off by one error
|
||||
- [0c0a678c](https://git.meli-email.org/meli/meli/commit/0c0a678cffec73940065923bb3837deb85075f9f) Fix overlay widgets not being reaped after Unrealize event
|
||||
- [65179d48](https://git.meli-email.org/meli/meli/commit/65179d4816a39b0c92e9c6a981b491c60313634f) Fix cursor/widget focus scrolling logic
|
||||
- [e64923ee](https://git.meli-email.org/meli/meli/commit/e64923eeaaf1fdf0ee485cceff0c57b2d43f165a) Fix debug_assert condition
|
||||
- [5f29faa6](https://git.meli-email.org/meli/meli/commit/5f29faa640ebe7b14e76e56227a482207b8d952e) Clippy lint fixes
|
||||
- [0b258a1f](https://git.meli-email.org/meli/meli/commit/0b258a1f058fa08b143a8e573883a4abe89dc7e1) Clippy lint fixes
|
||||
- [ba7f5dce](https://git.meli-email.org/meli/meli/commit/ba7f5dce1c37c04768aa060b35f3803e6db3840e) Fix display of threaded conversations tree structure
|
||||
- [1dc1d868](https://git.meli-email.org/meli/meli/commit/1dc1d86848eb6d187120bcaa00296f2b4e2025ca) Fix infinite loop bug
|
||||
- [e8e49e74](https://git.meli-email.org/meli/meli/commit/e8e49e741b0f888d44da69f52aa3fff2e03e7ced) Fix wrong per message offset
|
||||
- [e3dfeaad](https://git.meli-email.org/meli/meli/commit/e3dfeaad7e4f838af5fb2e6e398d3e1aa37fe511) Fix compilation error when building without `gpgme` feature
|
||||
- [7998e1e7](https://git.meli-email.org/meli/meli/commit/7998e1e77ef057bab28434edefb79d7be6a4de33) Add missing LC libc constants for openbsd target_os
|
||||
- [b5657201](https://git.meli-email.org/meli/meli/commit/b5657201db4828c6e61c52e7ce338ac1a6e6f9fc) Fix doctest compilation errors
|
||||
- [c2ed3e28](https://git.meli-email.org/meli/meli/commit/c2ed3e283f6729ac7e112d00ae54dd99a2ada5e6) Fix Source::* view showing only envelope body
|
||||
- [d93ee413](https://git.meli-email.org/meli/meli/commit/d93ee413a766f35a4ef88d9fc3ace9cf37d28dd1) Add timestamp_to_string_utc
|
||||
- [6086a378](https://git.meli-email.org/meli/meli/commit/6086a3789d4d01818322dab1f1a9eb4c1f6a2b25) Fix libgpgme segfault error and re-enable gpg
|
||||
- [ab418c1d](https://git.meli-email.org/meli/meli/commit/ab418c1d39d02840bc5c61996c1a5416e2f35464) Refresh documentation, fix encryption/signing
|
||||
- [0219dc87](https://git.meli-email.org/meli/meli/commit/0219dc870798a16fd4d9f546d14c115f9e2c6bd8) Respect max_objects_in_get when fetching email
|
||||
- [6280bc75](https://git.meli-email.org/meli/meli/commit/6280bc75e550332a73c1a51dd46475cd54cc0a34) Fix blob download URL formatting
|
||||
- [2df73547](https://git.meli-email.org/meli/meli/commit/2df73547515fd3464e1fc2b88aa67462f583a8ec) Fix overflow substracts
|
||||
- [8e698cab](https://git.meli-email.org/meli/meli/commit/8e698cabcfe58ddd566133ba2c33249c23180a74) Fix unreachable-pub and disjoint-capture lint errors
|
||||
- [40d4ecef](https://git.meli-email.org/meli/meli/commit/40d4ecefa013caaa13af493233c693fb495360ca) Accept invalid (non-ascii) address comment text
|
||||
- [4e654d2d](https://git.meli-email.org/meli/meli/commit/4e654d2d02044be7340b63f1250d37b2ca57b221) Limit LIST ACTIVE command length to 512 octets
|
||||
- [84081f4e](https://git.meli-email.org/meli/meli/commit/84081f4ed7570dd8bcc23d90b9c4cbff55620636) Minor style fix
|
||||
- [97d36868](https://git.meli-email.org/meli/meli/commit/97d3686815c011bb8f1d4e448f12b2294693730d) Use Happy Eyeballs algorithm ź¬
|
||||
- [96f0b3e6](https://git.meli-email.org/meli/meli/commit/96f0b3e6b484c9cbb7eaddcaad2b59811b733545) Fix shortcut section order
|
||||
- [64982b4c](https://git.meli-email.org/meli/meli/commit/64982b4cab0b0c2d396cb5dcf7add6f268fd4551) Fix page{up,down} event bubbling up
|
||||
- [8551e1ba](https://git.meli-email.org/meli/meli/commit/8551e1ba0b4fa6d9587bbb249f11e9b80d24e4d3) Fix new 1.72 default clippy lints
|
||||
|
||||
### Changed
|
||||
|
||||
- [8563bccd](https://git.meli-email.org/meli/meli/commit/8563bccd1b6d48dc06dd521f77228c3cbecf7613) Don't cache CellBuffer, only row info
|
||||
- [0f6f3e30](https://git.meli-email.org/meli/meli/commit/0f6f3e30c67f209e0b5e03d2dd2e1e48180d9855) Add IMAP config in config parse test
|
||||
- [ce269c64](https://git.meli-email.org/meli/meli/commit/ce269c64e16db344f0e65461e56dbced2f1a4d64) Don't fail on `server_password_command`
|
||||
- [9dc4d405](https://git.meli-email.org/meli/meli/commit/9dc4d4055cb2f854e835748315677bf4a2db2012) Add focus_{left,right} shortcuts to switch focus
|
||||
- [4b96bd59](https://git.meli-email.org/meli/meli/commit/4b96bd591f18bf7c8a3c922d469b81072d1782a2) Add ColorCache constructor to deduplicate code
|
||||
- [c06c3f58](https://git.meli-email.org/meli/meli/commit/c06c3f589315f017a412f31d80559a5a734d7b89) Draw gap between list and mail view
|
||||
- [c9d26bb4](https://git.meli-email.org/meli/meli/commit/c9d26bb4158e2f423c795f82bcb2c91a0f0c46ec) Add configurable custom hooks with shell commands
|
||||
- [02e86d1f](https://git.meli-email.org/meli/meli/commit/02e86d1fade9faefc14b890e3cec8ed2255bb839) Check for subject overflow on draw
|
||||
- [8cab9d9d](https://git.meli-email.org/meli/meli/commit/8cab9d9da8710257f2b62832bfac802c2a35b368) Add option to hide consecutive identical From values inside a thread
|
||||
- [363f4930](https://git.meli-email.org/meli/meli/commit/363f4930994d1d2e88220878b3848f176b8c5f97) Add {previous,next}_entry shortcuts to quickly open other mail entries
|
||||
- [342df091](https://git.meli-email.org/meli/meli/commit/342df091a076bce1f8477dabbad193312d8cdd67) Don't set all thread to seen when opening a thread entry
|
||||
- [74e15316](https://git.meli-email.org/meli/meli/commit/74e15316dbbf67254023e619924e522f80e77cb9) Open message/rfc822 attachments in subview instead of new tab
|
||||
- [369c1dbd](https://git.meli-email.org/meli/meli/commit/369c1dbdac9842746270a3d3c5bf7ed2205cb644) Show `open` command in status bar
|
||||
- [519257b0](https://git.meli-email.org/meli/meli/commit/519257b08f7029fe71efd2f61ab3a29a4b43b862) Add relative_menu_indices setting for menubar
|
||||
- [8abc9358](https://git.meli-email.org/meli/meli/commit/8abc9358a70465b12a11168be1718ab06479d6e2) Add newline after Version: 1 header
|
||||
- [561ba9c8](https://git.meli-email.org/meli/meli/commit/561ba9c87b57e1012ad89bde08506a2beacb7fff) Add relative_list_indices setting for thread listing
|
||||
- [52874f9a](https://git.meli-email.org/meli/meli/commit/52874f9a97a4799fcff2e14c43cafe9692f21cb6) Cancel previous jobs on MailView drop/update
|
||||
- [9037f084](https://git.meli-email.org/meli/meli/commit/9037f08495894c15a7817594ba91e0d5561c6e69) Replace hardcoded Key::{Home,End} values with shortcut values
|
||||
- [31aa9ad2](https://git.meli-email.org/meli/meli/commit/31aa9ad29e33f285314d0d320a02f00071f61282) Autogen mbox filename when exporting mail to directories
|
||||
|
||||
### Refactoring
|
||||
|
||||
- [330a2b20](https://git.meli-email.org/meli/meli/commit/330a2b20ed492f6b6ea86c196d43d67430487faa) Flush stdout in Ask() after printing
|
||||
- [340d6451](https://git.meli-email.org/meli/meli/commit/340d6451a330861af09fd02231c17ba4168d9654) Add config setting for sidebar ratio
|
||||
- [d0de0485](https://git.meli-email.org/meli/meli/commit/d0de04854ec4770b54e4d8303a9b8ab9eb5d68b0) Add {in,de}crease_sidebar shortcuts
|
||||
- [f5dc25ae](https://git.meli-email.org/meli/meli/commit/f5dc25ae0d5b8d6fb15a534fa49557385d6894d0) Check that all conf flags are recognized in validation
|
||||
- [d3e62e3d](https://git.meli-email.org/meli/meli/commit/d3e62e3d74bdc55872bbdf92c01d18aa00b0affd) Use conf shortcuts for scroll {up, down}
|
||||
- [23c23556](https://git.meli-email.org/meli/meli/commit/23c2355662d589c091dd3c86c8d91c7988eb941c) Fill and align shortcut table columns
|
||||
- [5823178c](https://git.meli-email.org/meli/meli/commit/5823178cc26f66ba902a901522f0506b4348b22e) Add test that looks in source code for invalid theme key references
|
||||
- [9205f3b8](https://git.meli-email.org/meli/meli/commit/9205f3b8afe28ef3a68959d590ed967946a5d622) Handle a per account mail order parameter
|
||||
- [d921b3c3](https://git.meli-email.org/meli/meli/commit/d921b3c3209ff7fe865b5a3b90e20098b3ff211f) Use mail sorting parameters from config
|
||||
- [f4e0970d](https://git.meli-email.org/meli/meli/commit/f4e0970d46e3ec73d684e2ddcc5011f61e87314d) Add ability to kill embed process
|
||||
- [bde87af3](https://git.meli-email.org/meli/meli/commit/bde87af3877d4a0b071e331c93a07e0acf51bf7a) Refactor filter() method in Listing trait
|
||||
- [a42a6ca8](https://git.meli-email.org/meli/meli/commit/a42a6ca868e4590a8b93560737173e80993ecaec) Show notifications in terminal if no alternative
|
||||
- [eb5949dc](https://git.meli-email.org/meli/meli/commit/eb5949dc9bbcf05f86c58b3c93d1066204313e2a) Switch summary<->details identifiers
|
||||
- [8c7b001a](https://git.meli-email.org/meli/meli/commit/8c7b001aa5d4cb6bbaf438f3f47cd91cc2fd6833) Add `thread_subject_pack` command to pack different inner thread subjects in entry title
|
||||
- [388d4e35](https://git.meli-email.org/meli/meli/commit/388d4e35d65f8f770526c4c5f44767c55eda23f8) Add in-progress messages while connecting in IMAP
|
||||
- [787c64c2](https://git.meli-email.org/meli/meli/commit/787c64c2da8af5cc0dafcb92c1d3bea6b54f3659) Remove expect()s from create_config_file()
|
||||
- [b87d54ea](https://git.meli-email.org/meli/meli/commit/b87d54ea3f3f077b6330e798263be6a3d33b3b9c) Impl Into<BTreeSet<EnvelopeHash>> for EnvelopeHashBatch
|
||||
- [e450ad0f](https://git.meli-email.org/meli/meli/commit/e450ad0f9cbc2d215a8f03d2d39260abe19fb5af) Remove unused struct
|
||||
- [c54a31f7](https://git.meli-email.org/meli/meli/commit/c54a31f7cca728eec87f7cd670a4baec37dc919a) Break line for error messages
|
||||
- [7935e49a](https://git.meli-email.org/meli/meli/commit/7935e49a00190cc7f2057abe353739c8dad4f74d) Check properly if mailbox request is an error
|
||||
- [117d7fbe](https://git.meli-email.org/meli/meli/commit/117d7fbe046fe23c400a925ccba7317d8a1d3f08) Make private fields public
|
||||
- [ffb12c6d](https://git.meli-email.org/meli/meli/commit/ffb12c6d1ae9a774de22a25d38bc6714a435c7ad) Make all public struct fields public
|
||||
- [46a038dc](https://git.meli-email.org/meli/meli/commit/46a038dc68093b28b69c3af38de4dd09431efae2) Remove interactive messages when #[cfg(test)]
|
||||
- [803d3414](https://git.meli-email.org/meli/meli/commit/803d3414fd73743ff5bfc0fefe5e3d76d88e58cb) Implement some rfc5804 commands
|
||||
- [b776409d](https://git.meli-email.org/meli/meli/commit/b776409d6c9caec3732bada9e25637c2676af3b8) Add thread, env hash index fields
|
||||
- [cc439b23](https://git.meli-email.org/meli/meli/commit/cc439b239ae27ae84fbcf50fbd82ec591c147c94) Add RowsState struct
|
||||
- [db227dea](https://git.meli-email.org/meli/meli/commit/db227dea34caa747e136500356fddf95a91002e6) Add error messages if `mandoc`,`man` binaries are missing
|
||||
- [ee9d458b](https://git.meli-email.org/meli/meli/commit/ee9d458b05ffa0214a4526daf1423916830526bc) Implement mailbox {un,}sub actions
|
||||
- [7af89359](https://git.meli-email.org/meli/meli/commit/7af893597f5a3f3261bfff47dae0723bf1b17e53) Replace use of Self::DESCRIPTION with Shortcuts struct consts
|
||||
- [eaecc5ea](https://git.meli-email.org/meli/meli/commit/eaecc5ea12f4a5ebe309d5654509c0771bbdc2f1) Remove hardcoded major .so version for non linux/macos target_os
|
||||
- [f63ce388](https://git.meli-email.org/meli/meli/commit/f63ce388f7774ea015fdaa2362202c33f3ddacd4) Move ManageMailboxes to Tab Actions
|
||||
- [3c847ad2](https://git.meli-email.org/meli/meli/commit/3c847ad26afcc4a4cdcfbdbf70f35be57d0da1ab) Add beginning of sieve parser
|
||||
- [5443b7e8](https://git.meli-email.org/meli/meli/commit/5443b7e8f300a0084abde7354360ecbe909178bb) Remove literal_map() parse combinator
|
||||
- [12cb717b](https://git.meli-email.org/meli/meli/commit/12cb717bda186b0ebdda18e2215e30b1426fb08a) Add server_password_command to jmap
|
||||
- [428f752b](https://git.meli-email.org/meli/meli/commit/428f752b20cdb1c8ab01e7f3119001cfafca8ef1) Remove obsolete crate::components::mail::get_display_name()
|
||||
- [91557c2c](https://git.meli-email.org/meli/meli/commit/91557c2c4366b481e80943e94f661c8b47150571) Prevent list blank when refreshing account
|
||||
- [d332e457](https://git.meli-email.org/meli/meli/commit/d332e4578d69c4371418fb2bb3c0d75e1960e01f) Add proper Display impl for HeaderName
|
||||
- [f537c249](https://git.meli-email.org/meli/meli/commit/f537c24909d13a53a95b43e265e4cb4c013334ac) Move text field to its own module
|
||||
- [d33f9d54](https://git.meli-email.org/meli/meli/commit/d33f9d54c708699386a3f32e4056ccab6c68528b) Remove unreachable!() in Key::serialize
|
||||
- [330887c4](https://git.meli-email.org/meli/meli/commit/330887c4f5bad5357508b9fa6f723e45ab307d2a) Introduce imap-codec.
|
||||
- [4da53669](https://git.meli-email.org/meli/meli/commit/4da5366959145e166c40297abfdf1876e5addc50) Remove bincode dep, use serde_json for sqlite3 values
|
||||
- [155fb41b](https://git.meli-email.org/meli/meli/commit/155fb41b93708ef8793250f9dea611bc317a86d5) Remove unused Component::set_id method
|
||||
- [575509f1](https://git.meli-email.org/meli/meli/commit/575509f1edc756ad218bb76cf74460d83009c851) Move mail view to listing parent component
|
||||
- [6858ee1f](https://git.meli-email.org/meli/meli/commit/6858ee1fab3bcddbda7335f49c30f36153e8d4b7) Move subcommand handling to its own module
|
||||
- [b0e867eb](https://git.meli-email.org/meli/meli/commit/b0e867eb68dc3dba96de79f7481989187fa12df4) Move src to meli/src
|
||||
- [48a10f72](https://git.meli-email.org/meli/meli/commit/48a10f724171bfae702b7b40438189adbbe75079) Remove unused BackendOp::fetch_flags() method
|
||||
- [073d43b9](https://git.meli-email.org/meli/meli/commit/073d43b9b869fc9d46c5195c31ad6e7806cf486c) Move data files to data subdir
|
||||
- [1e084c1d](https://git.meli-email.org/meli/meli/commit/1e084c1d854ed7efb2254f9e8d52ac13d8badffa) Move backends out of the backends module
|
||||
- [a5446975](https://git.meli-email.org/meli/meli/commit/a5446975c2423654dea9551474a880e94ebdc006) Move braille and screen to their own module files
|
||||
- [005bf388](https://git.meli-email.org/meli/meli/commit/005bf3881ec59d53e4f16473fb3b1857487dae23) Move components/utilities -> utilities
|
||||
- [64ab65dd](https://git.meli-email.org/meli/meli/commit/64ab65ddffe3341bca775acb2289ee00e771fdb0) Move components/contacts -> contacts
|
||||
- [7c9a4b4b](https://git.meli-email.org/meli/meli/commit/7c9a4b4b7c366c967a3378098d210124712fd293) Move components/mail -> mail
|
||||
- [df638cce](https://git.meli-email.org/meli/meli/commit/df638cceec6016760037b650a77143a07cd1e738) Remove stale failing doc code example
|
||||
- [da8e8104](https://git.meli-email.org/meli/meli/commit/da8e81044833975cadb08db836795a389c142e9c) Remove leftover debug prints
|
||||
- [a1e70061](https://git.meli-email.org/meli/meli/commit/a1e7006186474f55cf4a14f53dbd32bdf8ca5993) Move Sort{Order,Field} to utils mod
|
||||
- [66c21ab1](https://git.meli-email.org/meli/meli/commit/66c21ab1734bfbf4e604da505f6b6109008fd7c2) Move StandardHeader to its own module
|
||||
- [946309c6](https://git.meli-email.org/meli/meli/commit/946309c6f3bbc59b53dc2b05732b40f3d445fd9f) Do some small parser refactoring
|
||||
- [b95f7783](https://git.meli-email.org/meli/meli/commit/b95f778335bebd480f69fe66fabec4f8a6e2b587) Move JmapSession to its own module
|
||||
|
||||
### Documentation
|
||||
|
||||
- [a866b294](https://git.meli-email.org/meli/meli/commit/a866b29499b44032545df4941b6cfec4ee2db8bb) Update valid shortcut entries from src/conf/shortcuts.rs
|
||||
- [f76f4ea3](https://git.meli-email.org/meli/meli/commit/f76f4ea3f7416a4a641d5891f19927aa354a3247) Add meli.7, a general tutorial document
|
||||
- [5fa4b626](https://git.meli-email.org/meli/meli/commit/5fa4b6260c60409579fe964970719f9ab60482cc) Add more screenshots
|
||||
- [7c711542](https://git.meli-email.org/meli/meli/commit/7c7115427dd5f6320a4305df3dc88a8567829720) Complete guide document
|
||||
- [30cc5d3d](https://git.meli-email.org/meli/meli/commit/30cc5d3d0220452630780c3238f393b9e1f2b93a) Add edit-config in manpages
|
||||
- [24103f33](https://git.meli-email.org/meli/meli/commit/24103f3310ca533791bdd07643fdb23a10c6031d) Add external-tools.md document
|
||||
- [b6c93e49](https://git.meli-email.org/meli/meli/commit/b6c93e49f2af3001b206a288edea02c58e14aa5b) Add use_tls option in IMAP connection settings
|
||||
- [34a54d3c](https://git.meli-email.org/meli/meli/commit/34a54d3c05efc3b56154179111c3e39e0f3fd8b1) Add some `TODO([#222](https://git.meli-email.org/meli/meli/issues/222))`s.
|
||||
|
||||
### Packaging
|
||||
|
||||
- [671ce9f6](https://git.meli-email.org/meli/meli/commit/671ce9f694a8e941826472caad8051998540bb1f) Add missing build dependencies
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- [25805229](https://git.meli-email.org/meli/meli/commit/2580522931fb29442598ac8932a13eaeb577bace) Log vcard parsing failures
|
||||
- [5f003a31](https://git.meli-email.org/meli/meli/commit/5f003a31be95a3877d1006f8a22e424a1183163d) Parse vCards with just LF instead of CRLF line endings
|
||||
- [d8e9a005](https://git.meli-email.org/meli/meli/commit/d8e9a00563c023abb0ff75aaa4ba3fa92626c5ce) Add quoted REFERENCES field in parsing of responses
|
||||
- [81d12656](https://git.meli-email.org/meli/meli/commit/81d1265601c299dee6405f3f9b4e81f89d3cfe29) Escape IMAP passwords properly
|
||||
- [0d8bedd2](https://git.meli-email.org/meli/meli/commit/0d8bedd2d5d3eb8eee831e75d1e14d45beefb847) Make is_online() await for connection
|
||||
- [d4b690d5](https://git.meli-email.org/meli/meli/commit/d4b690d5d3a7f6a6b57afd7a6177db0db20a9c94) Send password as byte literal on LOGIN
|
||||
- [2eb22a29](https://git.meli-email.org/meli/meli/commit/2eb22a290abb3f37bc77c3bc2771edfb60a1c314) Stop hardcoding certain component colors
|
||||
- [2c23ca34](https://git.meli-email.org/meli/meli/commit/2c23ca34cdee769a0f78a0b0ef934e5f20dd9567) Update most Cargo dependencies
|
||||
- [721891c2](https://git.meli-email.org/meli/meli/commit/721891c2955e9f5e223949bde2dd43604cec8390) Update nom dependency
|
||||
- [4fdc90b3](https://git.meli-email.org/meli/meli/commit/4fdc90b31ea56c046dfe5bf9bee0a118f9c03db1) Use `open` instead of `xdg-open` in macos
|
||||
- [9558b2ae](https://git.meli-email.org/meli/meli/commit/9558b2ae921aa35076f58d68b5898334a2797685) Parse Cp1253 as windows1253 encoding
|
||||
- [6a843d49](https://git.meli-email.org/meli/meli/commit/6a843d49830f8c70f510c4232ea63eb204d35319) Export list_mail_in_maildir_fs() function
|
||||
- [d6355a30](https://git.meli-email.org/meli/meli/commit/d6355a3043ec0b4b2a3e1c3fbb0ed66d2e87e7f4) Impl Debug for ParsingError
|
||||
- [dc5afa13](https://git.meli-email.org/meli/meli/commit/dc5afa13dbea4da042c35e12291c5b5a2846c3ff) Use osascript/applescript for notifications on macos
|
||||
- [e6d6e1f5](https://git.meli-email.org/meli/meli/commit/e6d6e1f588db9793e822cdbb1ce2edb2959170c6) Don't unwrap if pseudoterminal creation fails
|
||||
- [ca84906d](https://git.meli-email.org/meli/meli/commit/ca84906d7ddb1351643998efaa56086e3ba9cf8e) Escape all quotes in applescript on macos
|
||||
- [4a79b202](https://git.meli-email.org/meli/meli/commit/4a79b2021d2fb3edd046197b44b702bdb468fc5e) Update dependency versions
|
||||
- [e29041f7](https://git.meli-email.org/meli/meli/commit/e29041f73354c59ef95916edd75e6ca7876e3c3a) Rename src/bin.rs to src/main.rs
|
||||
- [7650805c](https://git.meli-email.org/meli/meli/commit/7650805c60cec2fe09cd2a59cb665731f5cca140) Bring stripped binary size down to 7MiB
|
||||
- [ca488968](https://git.meli-email.org/meli/meli/commit/ca48896865778df2c79bc1d13f03b5f56136304c) Add strip option to profile.release
|
||||
- [10497952](https://git.meli-email.org/meli/meli/commit/10497952f718b49f3a247741a64361f855b2d4f7) Wrap stdout in BufWriter
|
||||
- [29042aba](https://git.meli-email.org/meli/meli/commit/29042aba593210f3be73010908d5092951b3b1a1) Add mbox date format parse
|
||||
- [480000eb](https://git.meli-email.org/meli/meli/commit/480000ebbb67a80181fd27762ca649acf13df0f3) Show error if account directory does not contain ".notmuch" subdirectory
|
||||
- [a484b397](https://git.meli-email.org/meli/meli/commit/a484b397c68fd126c17073ac9c9f02432c413341) Show informative error messages if libloading fails
|
||||
- [4a20fc42](https://git.meli-email.org/meli/meli/commit/4a20fc42e1f5cad325d5aa439d1baab210aceed8) Update CHANGELOG.md
|
||||
- [a72c96a2](https://git.meli-email.org/meli/meli/commit/a72c96a26afe9e54a0fcadb8c43448f1fdc09ce9) Add 8BITMIME support to smtp client
|
||||
- [3c0f5d82](https://git.meli-email.org/meli/meli/commit/3c0f5d8274d8039b1a2c928f99194835bca7b83a) Add BINARYMIME support to smtp client
|
||||
- [36883692](https://git.meli-email.org/meli/meli/commit/36883692782ed2355a0ec12ccf9f82aa2edcc8c1) Add smtp test
|
||||
- [9cbbf71e](https://git.meli-email.org/meli/meli/commit/9cbbf71e0f8f9115e9e043982f20045cfc550eb7) Add DecodeOptions struct for decoding
|
||||
- [0df46a63](https://git.meli-email.org/meli/meli/commit/0df46a63ec6e30983480f0eb50c8da3f74b4f0b3) Show error if sqlite3 search backend is set but doesn't exist
|
||||
- [a7a50d30](https://git.meli-email.org/meli/meli/commit/a7a50d3078cb7466ab341ddfc30a80c7b1f8dfdb) Box<_> some large fields in biggest types
|
||||
- [d8d43a16](https://git.meli-email.org/meli/meli/commit/d8d43a16fef045a2116ff126e7b6e27817b526fc) Add html_open config setting
|
||||
- [0ed10711](https://git.meli-email.org/meli/meli/commit/0ed10711ef542cc13eaaef809fa557468b3d6696) Add new_mail_script option
|
||||
- [c3fdafde](https://git.meli-email.org/meli/meli/commit/c3fdafde3b69c0abc78a62926e0c32fc3dd602d6) Documentation touchups
|
||||
- [347be543](https://git.meli-email.org/meli/meli/commit/347be54305c60350b055a1da3a1abfa4d33d3f22) Add NetworkErrorKind enum
|
||||
- [0c08cb73](https://git.meli-email.org/meli/meli/commit/0c08cb737ceaa5c738712905c7d57f956d449ed0) Mark mailboxes as subscribed on personal accounts
|
||||
- [129573e0](https://git.meli-email.org/meli/meli/commit/129573e0fd9b42ebf14c2de176e65b92bf8479bd) Rename root_path to root_mailbox
|
||||
- [7e09b180](https://git.meli-email.org/meli/meli/commit/7e09b1807ffa9bae54da35b02c83b5aaee455819) Replace _Ref deref unwraps with expect()
|
||||
- [55ed9624](https://git.meli-email.org/meli/meli/commit/55ed962425ba25d2317946705ff6861a77eb770f) Use server_url instead of server_hostname + server_port in config
|
||||
- [0ef4dde9](https://git.meli-email.org/meli/meli/commit/0ef4dde9392452f7cf7f18294f747fc6e0babb8d) Wrap serde_json deserialize errors in human readable errors
|
||||
- [dd0baa82](https://git.meli-email.org/meli/meli/commit/dd0baa82e9789da23c8f9b06925776c7f80e2568) Spawn user-given command strings with sh -c ".."
|
||||
- [3697b7d9](https://git.meli-email.org/meli/meli/commit/3697b7d960cc9dbe602fa84f861cea854b600b73) Don't use LC_ category in place of LC_ masks in libc calls
|
||||
- [6d20abdd](https://git.meli-email.org/meli/meli/commit/6d20abdde7b4cec6ec1af7c097f01042ea05cfbb) Add #[allow(deref_nullptr)] in bindgen tests
|
||||
- [17b42b1a](https://git.meli-email.org/meli/meli/commit/17b42b1a6c721fb2e369c2a300867c8db2beb959) Add json deserialization tests
|
||||
- [64346dd3](https://git.meli-email.org/meli/meli/commit/64346dd3fe0ef40025ec6fdb01d18eb38f7e7f65) Add map_res, quoted_slice, is_a, alt, take, take_literal
|
||||
- [56fc43bc](https://git.meli-email.org/meli/meli/commit/56fc43bcf869a867455b44d007b9d3d17422bc8d) Add As{Ref,Mut} impls for RwRef{,Mut}
|
||||
- [63179841](https://git.meli-email.org/meli/meli/commit/631798413659a320dcd9574e0bca7b7d75cc8d6c) Add --bin flag to meli cargo build target
|
||||
- [ded9adde](https://git.meli-email.org/meli/meli/commit/ded9adde614ac3d38045fa97a0f5144b80855fe7) More descriptive "Unimplemented" messages
|
||||
- [2224a710](https://git.meli-email.org/meli/meli/commit/2224a7100f9bc6c44bc66117a88556003e74186e) Reset imap cache on init error
|
||||
- [252d2bdf](https://git.meli-email.org/meli/meli/commit/252d2bdf2f12c8954f8b299000bbde6219d25335) Replace hardcoded /bin/false with 'false'
|
||||
- [2427b097](https://git.meli-email.org/meli/meli/commit/2427b097c5c40f3212a105cb40f913c9860ae2a8) Make tag_default background lighter on light theme
|
||||
- [7382e301](https://git.meli-email.org/meli/meli/commit/7382e30160a934ce97dd73c1be44640d5b4a4c75) Convert EnvelopeHash from typedef to wrapper struct
|
||||
- [259aeb00](https://git.meli-email.org/meli/meli/commit/259aeb00877557ee85b5cc555d50e605b85b3109) Convert {Account,Mailbox}Hash from typedef to wrapper struct
|
||||
- [5634f955](https://git.meli-email.org/meli/meli/commit/5634f9555315deb2d39ed8fce577a35f4d535ac1) Rename MeliError struct to Error
|
||||
- [7606317f](https://git.meli-email.org/meli/meli/commit/7606317f24d076bdc7db873c2b15811728ed946a) Add support for virtual mailbox hierarchy
|
||||
- [2878bbb8](https://git.meli-email.org/meli/meli/commit/2878bbb8c887275d26264bf7201a632161c4048a) Add parser for mutt alias file
|
||||
- [de2f46fe](https://git.meli-email.org/meli/meli/commit/de2f46fe611726a445c1e06cbc35343e716aa335) Rustfmt changes
|
||||
- [f9ac9b60](https://git.meli-email.org/meli/meli/commit/f9ac9b607a2bd01e42c81cfab3c933df28ff1676) Temporarily disable libgpgme functions because of a bug
|
||||
- [256a3e25](https://git.meli-email.org/meli/meli/commit/256a3e252e2e4db9af9a04c7df1a52eeaf2bbfc9) Update minimum supported rust version
|
||||
- [fbc1007f](https://git.meli-email.org/meli/meli/commit/fbc1007ff4f41bac888a1b53c156feec4f795403) Deserialize `null` to empty vec for messageId
|
||||
- [d7ec97f0](https://git.meli-email.org/meli/meli/commit/d7ec97f03bc0e815e160a142f871dc764d416af1) Small rustfmt change
|
||||
- [2447a2cb](https://git.meli-email.org/meli/meli/commit/2447a2cbfeaa8d6f7ec11a2a8a6f3be1ff2fea58) Avoid relying on hardcoded hash values
|
||||
- [d679a744](https://git.meli-email.org/meli/meli/commit/d679a74450b35724301c81da1644bcedb1c54045) Implement Bearer token authentication
|
||||
- [47e6d5d9](https://git.meli-email.org/meli/meli/commit/47e6d5d935a2b5124efbe847dac885b859200469) Add edit-config CLI subcommand that opens config files on EDITOR
|
||||
- [3a02b6fb](https://git.meli-email.org/meli/meli/commit/3a02b6fb8024e6bb046fc167e7527aad1b192202) Mention how to override w3m with html_filter
|
||||
- [85d4316a](https://git.meli-email.org/meli/meli/commit/85d4316a6a8703ac3e4923cf99ce8c4bb22bb4ae) Replace old logging module with the `log` create
|
||||
- [1f1ea307](https://git.meli-email.org/meli/meli/commit/1f1ea307698a5a7f62f5ab2ea1594aef4d8f48a8) On draw() set dirty on return
|
||||
- [77020e0c](https://git.meli-email.org/meli/meli/commit/77020e0c19873b8053321132ff5b58181c567fcd) Update CHANGELOG.md
|
||||
- [682ea554](https://git.meli-email.org/meli/meli/commit/682ea5547e380deeb215503b39c8aa66c65b3cac) Add `.idea` (CLion) to `.gitignore`.
|
||||
- [f63f6445](https://git.meli-email.org/meli/meli/commit/f63f6445addeccee1a6b830f1c101a043612ea4e) Improve error message when `m4` executable is missing.
|
||||
- [cc27639f](https://git.meli-email.org/meli/meli/commit/cc27639fca0dcb3a5ff9fceef8666dbbf047adaa) Use Envelope attachments when editing and don't add already existing headers
|
||||
- [30866f75](https://git.meli-email.org/meli/meli/commit/30866f752b21802b64ce7d2e02c9962c1091c9d8) Bypass rustfmt bug.
|
||||
- [235fceaf](https://git.meli-email.org/meli/meli/commit/235fceaf2168af50c3804cecfbf69e64ff42598c) Add standard heeder constants in email::headers
|
||||
- [aebff3d3](https://git.meli-email.org/meli/meli/commit/aebff3d3d9864b8854aba5e7f43a61d515e8057f) Implement mailto RFC properly
|
||||
- [954329d8](https://git.meli-email.org/meli/meli/commit/954329d848a5b3e73fca50ed1db9859118bed6dd) Set file extensions to temp files, use `open` in macos
|
||||
- [58889bca](https://git.meli-email.org/meli/meli/commit/58889bcadd44d6aec2eddd17cf5ecb1e07531cbe) Add show_extra_headers option
|
||||
- [23d95973](https://git.meli-email.org/meli/meli/commit/23d95973d4f574fe431441df97ceaef0e3e4762f) Add search.rs module
|
||||
- [6bf1756d](https://git.meli-email.org/meli/meli/commit/6bf1756de844386ba312d15109ae29951896147b) Implement more search criteria in Query type
|
||||
- [299c8e0f](https://git.meli-email.org/meli/meli/commit/299c8e0f993c4ac88005a5c9e708d9e214b20ac1) Restructure pub use melib::* imports
|
||||
- [f8623d4b](https://git.meli-email.org/meli/meli/commit/f8623d4b2c386f51f1d11a23900503d8165ac9f3) Implement more ResponseCode cases
|
||||
- [b92a80a2](https://git.meli-email.org/meli/meli/commit/b92a80a23afb96fbd63031704e4656cc8a00526c) Resync even if UIDVALIDITY is missing from cache
|
||||
- [bf615e7d](https://git.meli-email.org/meli/meli/commit/bf615e7d933b474942d421eafc1015aeb28f8516) Check for case when envelope has its own message id in References and In-Reply-To
|
||||
- [e0257c9d](https://git.meli-email.org/meli/meli/commit/e0257c9d8d6f234f71852a0080d443b063d5e6d7) Run cargo-sort
|
||||
- [d7e6b40b](https://git.meli-email.org/meli/meli/commit/d7e6b40b7e1f501fdaaba54880e9c7a4b0e01288) Auto re-index sqlite3 database if it's missing
|
||||
- [cd85d833](https://git.meli-email.org/meli/meli/commit/cd85d83324a009ea4b86ac22af395145a9e999ab) Replace timestamp with Date value in message/rfc822 Display
|
||||
- [579372b4](https://git.meli-email.org/meli/meli/commit/579372b4a75e39c9e84010de16d7d46294bed04a) Improve readability of `Envelope`.
|
||||
- [6c6d9f4b](https://git.meli-email.org/meli/meli/commit/6c6d9f4b4e0d16b5a73ae8e2a2fb2a6f124df7e6) Improve ordering of `flag_impl!`s.
|
||||
- [8f14a237](https://git.meli-email.org/meli/meli/commit/8f14a2373e16b9b4af22f9388fae84235dd08123) Put imap-codec logic under the imap_backend feature
|
||||
- [fd0faade](https://git.meli-email.org/meli/meli/commit/fd0faade066a18466e683361211bba569956bf63) Add connection instance id string for debugging in logs
|
||||
- [5c9b3fb0](https://git.meli-email.org/meli/meli/commit/5c9b3fb0448fa3689ff33faba3dde03c49347f61) Impl Component for Box<dyn Component>
|
||||
- [45bac6eb](https://git.meli-email.org/meli/meli/commit/45bac6eb16a5a093193d5beb4d80040ce161304a) Tidy up use of debug!
|
||||
- [5699baec](https://git.meli-email.org/meli/meli/commit/5699baecfba9cb15aac04a6b400cfb6bc881e2c5) Add utils::{futures, random}
|
||||
- [b05d9299](https://git.meli-email.org/meli/meli/commit/b05d92997546e438b202d336fc581c2514c63b9f) Impl exponential backoff when retrying connection
|
||||
- [f5cfbd32](https://git.meli-email.org/meli/meli/commit/f5cfbd32e6ebbe83ad7e84d048f1fbf2e51ca605) On set_flags, update {un,}seen sets in all mailboxes
|
||||
- [f0d88005](https://git.meli-email.org/meli/meli/commit/f0d88005fbabcd552593ba0fe785e89a3560ac1c) Change message/rfc822 Display repr
|
||||
- [f98e36ce](https://git.meli-email.org/meli/meli/commit/f98e36cee514f643e0fe256857cf31e2e0f24080) Replace old-style /*! module doc comments with //!
|
||||
- [1bcc0bbe](https://git.meli-email.org/meli/meli/commit/1bcc0bbece2f479950e8811261befedc0199dab9) Add mbox parsing test
|
||||
- [619fbef1](https://git.meli-email.org/meli/meli/commit/619fbef129e249489e64a26e1d0dfbd02db2516a) Recursively calculate update_show_subject()
|
||||
- [957abf4e](https://git.meli-email.org/meli/meli/commit/957abf4e7238ec74b2194a21533b69dd1a58c0a8) Update cargo dependencies
|
||||
- [9d51b6bd](https://git.meli-email.org/meli/meli/commit/9d51b6bd525784bc108959519c8dd21d30a8b020) Update `imap-codec`.
|
||||
- [7c33f899](https://git.meli-email.org/meli/meli/commit/7c33f8999b6a5efd911680f2b83a3ff3a682a715) Use published imap-codec 0.10.0.
|
||||
- [3803d788](https://git.meli-email.org/meli/meli/commit/3803d788abc5157b9cc6368da7e54aced9604aec) If auth is false checks if config has password entry
|
||||
- [866166eb](https://git.meli-email.org/meli/meli/commit/866166eb8e8b994c8c87aad92a3303f9f6449b2d) Don't print parsing error for empty bytes
|
||||
- [5b5869a2](https://git.meli-email.org/meli/meli/commit/5b5869a2ec3fce2fc69aa5c83fbda7a767f2a402) Re-enable print to stderr ifdef MELI_DEBUG_STDERR
|
||||
- [13fe64a0](https://git.meli-email.org/meli/meli/commit/13fe64a027895780efdb6bfee246d562741a4be1) Cache pgp signature verification results
|
||||
- [5ceddf41](https://git.meli-email.org/meli/meli/commit/5ceddf412e3b215b712e55aea8e18887d2d39f1a) Update CHANGELOG.md
|
||||
- [4e55fbc9](https://git.meli-email.org/meli/meli/commit/4e55fbc90d8b105788c7c5998cb26b2829ac87a2) Add SEEN flag to all envs, since NNTP has no flags
|
||||
- [e9cd800f](https://git.meli-email.org/meli/meli/commit/e9cd800f49e2d0e155d434ff8e91462e20b9d4f5) Add support for storing read status locally
|
||||
- [53cba4be](https://git.meli-email.org/meli/meli/commit/53cba4beee4f774b548881c1a3f207ca391d3df3) Update README.md relative file paths
|
||||
- [c4c245ee](https://git.meli-email.org/meli/meli/commit/c4c245ee19137f64d836401f7c1de17c9eb42b6e) Respect danger_accept_invalid_certs setting
|
||||
- [29b43e2c](https://git.meli-email.org/meli/meli/commit/29b43e2c88edcfdecffd076fbb773c8547425f12) Replace mktime with timegm
|
||||
- [4874e30f](https://git.meli-email.org/meli/meli/commit/4874e30f3ce9b186ac7cd427cba4a8542bd5048e) Add smtp-trace feature
|
||||
- [51e9fbe8](https://git.meli-email.org/meli/meli/commit/51e9fbe8f2c380f3c9ee6a9ee65e638c169b43ef) Add account_name identifier to sqlite3 index database name
|
||||
- [129f1091](https://git.meli-email.org/meli/meli/commit/129f10911b01641940801586bfa5286307e4342f) Rename `imap_backend` feature to `imap`
|
||||
- [fe027fa3](https://git.meli-email.org/meli/meli/commit/fe027fa300a9882730a558fffe6000527ef08ff8) Rename `maildir_backend` feature to `maildir`
|
||||
- [fe7dcc50](https://git.meli-email.org/meli/meli/commit/fe7dcc508ee51f492df2de3884147531fada6f4e) Rename `notmuch_backend` feature to `notmuch`
|
||||
- [e9f09a15](https://git.meli-email.org/meli/meli/commit/e9f09a153ca0a1a023efe924b314ea977ccc3c25) Rename `mbox_backend` feature to `mbox`
|
||||
- [7db930ca](https://git.meli-email.org/meli/meli/commit/7db930cabd295e888f4f106d5e7ea411521340ff) Rename `jmap_backend` feature to `jmap`
|
||||
- [89c90f22](https://git.meli-email.org/meli/meli/commit/89c90f224a68ec524f7dc7033955ce7b8196f493) Add `nntp` feature
|
||||
- [b65934fa](https://git.meli-email.org/meli/meli/commit/b65934facc7aeeb8ab30603e16cef2b747f9a0e5) Add nntp-trace feature
|
||||
- [8ecdb6df](https://git.meli-email.org/meli/meli/commit/8ecdb6df3189cae4b6fa21a177bde756cc4407cf) Add imap-trace feature
|
||||
- [9216e7bc](https://git.meli-email.org/meli/meli/commit/9216e7bc657738ae9861583a837c1326398197e4) Add opt id string for tracing
|
||||
- [ae25ffba](https://git.meli-email.org/meli/meli/commit/ae25ffba430572efe73fde05eaf8111453f814cf) Don't do plain EHLO before starting Tls connection
|
||||
- [8cb2a515](https://git.meli-email.org/meli/meli/commit/8cb2a515e1ba31efe914db67504993bc081ed7f3) Use localhost in lieu of 127.0.0.1 for CI
|
||||
- [0ee1b6e0](https://git.meli-email.org/meli/meli/commit/0ee1b6e01830c01871e93e27d735a39792202325) Start background watch job in init
|
||||
- [448e0635](https://git.meli-email.org/meli/meli/commit/448e0635e00b533a4d9dc15ba65982097649b397) Log error when command length exceeds 512 octets
|
||||
- [bf543855](https://git.meli-email.org/meli/meli/commit/bf543855dc143b25344b79303f017380c9773793) Add PartialEq<str> for MessageID
|
||||
- [7c7f6e19](https://git.meli-email.org/meli/meli/commit/7c7f6e1923e8b3127cf7cbd4b18f1db3ed9c6583) Don't increase Thread length for duplicates
|
||||
- [5c2b0471](https://git.meli-email.org/meli/meli/commit/5c2b04719b953373c6a657f22db295d08b94685e) Normalize std::fmt::* imports
|
||||
- [0f60009e](https://git.meli-email.org/meli/meli/commit/0f60009ea909adfb8f4e85d942decb8bc60f7539) Add RUSTFLAGS with -D warnings
|
||||
- [6578a566](https://git.meli-email.org/meli/meli/commit/6578a5666889434ed6ca2f276e365633956fe3d3) Update cargo install directions
|
||||
- [4f6081b6](https://git.meli-email.org/meli/meli/commit/4f6081b6633aed1eeafd99c24aa2dc64397043ca) Update to `imap-codec 1.0.0-beta`.
|
||||
- [dc2b0044](https://git.meli-email.org/meli/meli/commit/dc2b00442b04c21455a6fda59b4729d0cbd04eff) Run rustfmt and cargo-sort
|
||||
- [b3858de2](https://git.meli-email.org/meli/meli/commit/b3858de2f4e12723ee922174c79cc36062bed54e) Impl From<io::ErrorKind> for ErrorKind
|
||||
- [f93adb68](https://git.meli-email.org/meli/meli/commit/f93adb683a562f25e40ffa03f80d04d5ad8ca34f) Replace change_color uses with change_theme
|
||||
- [f193bdf6](https://git.meli-email.org/meli/meli/commit/f193bdf685e06652ab5b2da2a9a01fa56620cda6) Add column headers and sorting
|
||||
- [095d24f9](https://git.meli-email.org/meli/meli/commit/095d24f91447a2ecab6d6bc78e1705ea4394e9bd) Add PULL_REQUEST_TEMPLATE.md
|
||||
- [ab57e942](https://git.meli-email.org/meli/meli/commit/ab57e9420db29efd42773e970f33751b7b3f6f26) Add delete_contact shortcut
|
||||
- [3963103d](https://git.meli-email.org/meli/meli/commit/3963103d55db28f789fe39f0dd80cd0d57792b5d) Prevent duplicate contact creation
|
||||
- [f162239f](https://git.meli-email.org/meli/meli/commit/f162239fcc87d9c4f8aba8c33a9812a5e691c8d9) Change `on:` conditions for test.yaml
|
||||
- [974b3a53](https://git.meli-email.org/meli/meli/commit/974b3a53058181e3df992a2105abcbf1c392fc19) Update bitflags, rusqlite dependencies
|
||||
- [4d22b669](https://git.meli-email.org/meli/meli/commit/4d22b669bf330f8f3168fc2f704ad63c21c5e821) Update dependencies
|
||||
- [ffba203a](https://git.meli-email.org/meli/meli/commit/ffba203a3b7070cc9e71d9444556e108ff0e18ea) Add support for Home and End key navigation
|
||||
- [3433f7c4](https://git.meli-email.org/meli/meli/commit/3433f7c41e0d0cbb48af821280537da41b9e53d0) Update PULL_REQUEST_TEMPLATE.md
|
||||
- [f7a4741b](https://git.meli-email.org/meli/meli/commit/f7a4741bf1622ae60042fb6ab0a906fe50fb1e06) Add jmap-trace feature
|
||||
- [c875dda4](https://git.meli-email.org/meli/meli/commit/c875dda4960e5688b17176ba82ad1e5da38b883b) Add last_method_response field to Connection
|
||||
- [37a787e6](https://git.meli-email.org/meli/meli/commit/37a787e6bb5abd34fae2888944537dec1ee3842f) Use IndexMap instead of HashMap
|
||||
- [6ebdc7f9](https://git.meli-email.org/meli/meli/commit/6ebdc7f9aec5531c2b562a4e0cfd320ead6a4c01) Add Id<_>::empty() contructor
|
||||
- [4f9b9773](https://git.meli-email.org/meli/meli/commit/4f9b97736a4af8b8b4ba0017ad1175a1c2352db6) Rename EmailImport to EmailImportObject
|
||||
- [11432ba2](https://git.meli-email.org/meli/meli/commit/11432ba2c381b07bb540f7f92664b3c351e3cf62) Make `null` fields into Option<_>s
|
||||
- [d9467d5f](https://git.meli-email.org/meli/meli/commit/d9467d5fcd9543611ec8a034eb7e25d12a3dcc45) Save all core capabilities to session store
|
||||
- [31982931](https://git.meli-email.org/meli/meli/commit/31982931f5f472717b4c3d900f16c0588682f48e) Use Argument<OBJ> (value or resultreference) where appropriate
|
||||
- [29fd8522](https://git.meli-email.org/meli/meli/commit/29fd8522e6bc2b0b6196cb97c8868dc34c2ba2f0) Implement Backend::create_mailbox()
|
||||
- [5d8f07c8](https://git.meli-email.org/meli/meli/commit/5d8f07c8058261c7c251b3fb010ad866110e91df) Rename some objects better
|
||||
- [38bc1369](https://git.meli-email.org/meli/meli/commit/38bc1369cc136c482f48d1ed3172b7f510ff7762) Add an Identity type.
|
||||
- [59513b26](https://git.meli-email.org/meli/meli/commit/59513b267097cac8fe757c6198f26e0179014604) Implement Backend::submit(), server-side submission
|
||||
- [5459a84f](https://git.meli-email.org/meli/meli/commit/5459a84f3d2b4c91a89252fba63f4ef12d965b9b) Update to imap-codec 1.0.0 (w/o `-beta`)
|
||||
- [290cfb86](https://git.meli-email.org/meli/meli/commit/290cfb86c0c942690c48a0d3298e9d2de3ec4d94) Add a highlighted_selected theme key
|
||||
- [46636d87](https://git.meli-email.org/meli/meli/commit/46636d8748f2779f38a10c6bf38c4e07acf16f8a) Bump version to 0.8.0
|
||||
|
||||
### Continuous Integration
|
||||
|
||||
- [1d0405ed](https://git.meli-email.org/meli/meli/commit/1d0405ed5b5cd76f4fe79e73fb30f4d4dce1d441) Add env vars
|
||||
- [6e27edcb](https://git.meli-email.org/meli/meli/commit/6e27edcb775ce831b784d2040672f2d2af2c020f) Use cargo-nextest
|
||||
- [67d2da0f](https://git.meli-email.org/meli/meli/commit/67d2da0f88b0e7b9b74c5d05c6c17a45057b094a) Disable smtp::test::test_smtp in test.yaml
|
||||
|
||||
## [alpha-0.7.2] - 2021-10-15
|
||||
|
||||
|
@ -90,7 +591,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- melib/nntp: implement refresh
|
||||
- melib/nntp: update total/new counters on new articles
|
||||
- melib/nntp: implement NNTP posting
|
||||
- configs: throw error on extra unusued conf flags in some imap/nntp
|
||||
- configs: throw error on extra unused conf flags in some imap/nntp
|
||||
- configs: throw error on missing `composing` section with explanation
|
||||
|
||||
### Fixed
|
||||
|
@ -225,3 +726,8 @@ Notable changes:
|
|||
[alpha-0.7.0]: https://github.com/meli/meli/releases/tag/alpha-0.7.0
|
||||
[alpha-0.7.1]: https://github.com/meli/meli/releases/tag/alpha-0.7.1
|
||||
[alpha-0.7.2]: https://github.com/meli/meli/releases/tag/alpha-0.7.2
|
||||
[v0.8.0]: https://git.meli-email.org/meli/meli/releases/tag/v0.8.0
|
||||
[v0.8.1]: https://git.meli-email.org/meli/meli/releases/tag/v0.8.1
|
||||
[v0.8.2]: https://git.meli-email.org/meli/meli/releases/tag/v0.8.2
|
||||
[v0.8.3]: https://git.meli-email.org/meli/meli/releases/tag/v0.8.3
|
||||
[v0.8.4]: https://git.meli-email.org/meli/meli/releases/tag/v0.8.4
|
||||
|
|
|
@ -19,13 +19,14 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
|||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.3"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
|
||||
checksum = "cd7d5a2cecb58716e47d67d5703a249964b14c7be1ec3cad3affc295b2d1c35d"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -103,7 +104,7 @@ checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
|
|||
dependencies = [
|
||||
"async-lock",
|
||||
"autocfg",
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"concurrent-queue",
|
||||
"futures-lite",
|
||||
"log",
|
||||
|
@ -111,7 +112,7 @@ dependencies = [
|
|||
"polling",
|
||||
"rustix 0.37.23",
|
||||
"slab",
|
||||
"socket2",
|
||||
"socket2 0.4.9",
|
||||
"waker-fn",
|
||||
]
|
||||
|
||||
|
@ -146,7 +147,7 @@ dependencies = [
|
|||
"async-lock",
|
||||
"autocfg",
|
||||
"blocking",
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"event-listener",
|
||||
"futures-lite",
|
||||
"rustix 0.37.23",
|
||||
|
@ -196,7 +197,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
|||
dependencies = [
|
||||
"hermit-abi 0.1.19",
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -302,12 +303,6 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
|
@ -325,7 +320,7 @@ dependencies = [
|
|||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -370,7 +365,7 @@ version = "1.3.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -379,7 +374,7 @@ version = "0.8.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"crossbeam-channel",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-epoch",
|
||||
|
@ -393,7 +388,7 @@ version = "0.5.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
|
@ -403,7 +398,7 @@ version = "0.8.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
@ -415,9 +410,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
"memoffset 0.9.0",
|
||||
"memoffset",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
|
@ -427,7 +422,7 @@ version = "0.3.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
|
@ -437,7 +432,7 @@ version = "0.8.16"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -472,8 +467,8 @@ dependencies = [
|
|||
"openssl-probe",
|
||||
"openssl-sys",
|
||||
"schannel",
|
||||
"socket2",
|
||||
"winapi 0.3.9",
|
||||
"socket2 0.4.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -489,7 +484,7 @@ dependencies = [
|
|||
"openssl-sys",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -506,7 +501,7 @@ checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"libdbus-sys",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -521,7 +516,7 @@ version = "2.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"dirs-sys-next",
|
||||
]
|
||||
|
||||
|
@ -533,7 +528,7 @@ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -612,9 +607,15 @@ version = "0.8.33"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.2"
|
||||
|
@ -675,7 +676,7 @@ version = "0.2.22"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall 0.3.5",
|
||||
"windows-sys",
|
||||
|
@ -721,41 +722,15 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsevent"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"fsevent-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsevent-sys"
|
||||
version = "2.0.1"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0"
|
||||
checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"fuchsia-zircon-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon-sys"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.28"
|
||||
|
@ -866,7 +841,7 @@ version = "0.2.10"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
@ -1002,10 +977,20 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "inotify"
|
||||
version = "0.7.1"
|
||||
name = "indexmap"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f"
|
||||
checksum = "ad227c3af19d4914570ad36d30409928b75967c298feb9ea1969db3a610bb14e"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.14.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inotify"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"inotify-sys",
|
||||
|
@ -1027,7 +1012,7 @@ version = "0.1.12"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1041,15 +1026,6 @@ dependencies = [
|
|||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iovec"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "isahc"
|
||||
version = "1.7.2"
|
||||
|
@ -1104,13 +1080,23 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "kernel32-sys"
|
||||
version = "0.2.2"
|
||||
name = "kqueue"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c"
|
||||
dependencies = [
|
||||
"winapi 0.2.8",
|
||||
"winapi-build",
|
||||
"kqueue-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kqueue-sys"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1119,17 +1105,11 @@ version = "1.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "lazycell"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.147"
|
||||
version = "0.2.153"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
||||
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
||||
|
||||
[[package]]
|
||||
name = "libdbus-sys"
|
||||
|
@ -1137,6 +1117,7 @@ version = "0.2.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06085512b750d640299b79be4bad3d2fa90a9c00b1fd9e1b46364f66f0485c72"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
|
@ -1146,8 +1127,8 @@ version = "0.7.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"winapi 0.3.9",
|
||||
"cfg-if",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1185,9 +1166,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "linkify"
|
||||
version = "0.8.1"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28d9967eb7d0bc31c39c6f52e8fce42991c0cd1f7a2078326f0b7a399a584c8d"
|
||||
checksum = "f1dfa36d52c581e9ec783a7ce2a5e0143da6237be5811a0b3153fedfdbe9f780"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -1262,21 +1243,20 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "meli"
|
||||
version = "0.8.2"
|
||||
version = "0.8.5-rc.3"
|
||||
dependencies = [
|
||||
"async-task",
|
||||
"bitflags 2.4.0",
|
||||
"crossbeam",
|
||||
"flate2",
|
||||
"futures",
|
||||
"indexmap",
|
||||
"indexmap 1.9.3",
|
||||
"libc",
|
||||
"libz-sys",
|
||||
"linkify",
|
||||
"melib",
|
||||
"nix",
|
||||
"notify",
|
||||
"notify-rust",
|
||||
"num_cpus",
|
||||
"pcre2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1298,7 +1278,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "melib"
|
||||
version = "0.8.2"
|
||||
version = "0.8.5-rc.3"
|
||||
dependencies = [
|
||||
"async-stream",
|
||||
"base64 0.13.1",
|
||||
|
@ -1309,7 +1289,7 @@ dependencies = [
|
|||
"flate2",
|
||||
"futures",
|
||||
"imap-codec",
|
||||
"indexmap",
|
||||
"indexmap 1.9.3",
|
||||
"isahc",
|
||||
"libc",
|
||||
"libloading",
|
||||
|
@ -1328,9 +1308,10 @@ dependencies = [
|
|||
"serde_path_to_error",
|
||||
"smallvec",
|
||||
"smol",
|
||||
"socket2",
|
||||
"socket2 0.5.5",
|
||||
"stderrlog",
|
||||
"unicode-segmentation",
|
||||
"url",
|
||||
"uuid",
|
||||
"xdg",
|
||||
]
|
||||
|
@ -1341,15 +1322,6 @@ version = "2.6.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76fc44e2588d5b436dbc3c6cf62aef290f90dab6235744a93dfe1cc18f451e2c"
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.9.0"
|
||||
|
@ -1382,45 +1354,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.6.23"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4"
|
||||
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"fuchsia-zircon",
|
||||
"fuchsia-zircon-sys",
|
||||
"iovec",
|
||||
"kernel32-sys",
|
||||
"libc",
|
||||
"log",
|
||||
"miow",
|
||||
"net2",
|
||||
"slab",
|
||||
"winapi 0.2.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio-extras"
|
||||
version = "2.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19"
|
||||
dependencies = [
|
||||
"lazycell",
|
||||
"log",
|
||||
"mio",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miow"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d"
|
||||
dependencies = [
|
||||
"kernel32-sys",
|
||||
"net2",
|
||||
"winapi 0.2.8",
|
||||
"ws2_32-sys",
|
||||
"wasi",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1441,27 +1382,16 @@ dependencies = [
|
|||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "net2"
|
||||
version = "0.2.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.24.3"
|
||||
version = "0.27.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
|
||||
checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"cfg-if 1.0.0",
|
||||
"bitflags 2.4.0",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"memoffset 0.6.5",
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1476,27 +1406,28 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "4.0.17"
|
||||
version = "6.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257"
|
||||
checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.0",
|
||||
"crossbeam-channel",
|
||||
"filetime",
|
||||
"fsevent",
|
||||
"fsevent-sys",
|
||||
"inotify",
|
||||
"kqueue",
|
||||
"libc",
|
||||
"log",
|
||||
"mio",
|
||||
"mio-extras",
|
||||
"walkdir",
|
||||
"winapi 0.3.9",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notify-rust"
|
||||
version = "4.9.0"
|
||||
version = "4.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d7b75c8958cb2eab3451538b32db8a7b74006abc33eb2e6a9a56d21e4775c2b"
|
||||
checksum = "827c5edfa80235ded4ab3fe8e9dc619b4f866ef16fe9b1c6b8a7f8692c0f2226"
|
||||
dependencies = [
|
||||
"dbus",
|
||||
"log",
|
||||
|
@ -1513,16 +1444,6 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
|
||||
dependencies = [
|
||||
"hermit-abi 0.3.2",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "numtoa"
|
||||
version = "0.1.0"
|
||||
|
@ -1571,7 +1492,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c"
|
||||
dependencies = [
|
||||
"bitflags 2.4.0",
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
"once_cell",
|
||||
|
@ -1699,7 +1620,7 @@ checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce"
|
|||
dependencies = [
|
||||
"autocfg",
|
||||
"bitflags 1.3.2",
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"concurrent-queue",
|
||||
"libc",
|
||||
"log",
|
||||
|
@ -1837,7 +1758,7 @@ dependencies = [
|
|||
"spin",
|
||||
"untrusted",
|
||||
"web-sys",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2018,6 +1939,15 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1_smol"
|
||||
version = "1.0.0"
|
||||
|
@ -2096,7 +2026,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2186,7 +2126,7 @@ version = "3.8.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"fastrand 2.0.0",
|
||||
"redox_syscall 0.3.5",
|
||||
"rustix 0.38.9",
|
||||
|
@ -2255,7 +2195,7 @@ version = "1.1.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
|
@ -2304,12 +2244,37 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.11"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
|
||||
checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"indexmap 2.0.1",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03"
|
||||
dependencies = [
|
||||
"indexmap 2.0.1",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2318,7 +2283,7 @@ version = "0.1.37"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
|
@ -2403,6 +2368,7 @@ dependencies = [
|
|||
"form_urlencoded",
|
||||
"idna",
|
||||
"percent-encoding",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2456,7 +2422,7 @@ version = "0.2.87"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
|
@ -2524,12 +2490,6 @@ dependencies = [
|
|||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
@ -2540,12 +2500,6 @@ dependencies = [
|
|||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-build"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
|
@ -2558,7 +2512,7 @@ version = "0.1.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2686,13 +2640,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "ws2_32-sys"
|
||||
version = "0.2.1"
|
||||
name = "winnow"
|
||||
version = "0.5.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||
checksum = "9b5c3db89721d50d0e2a673f5043fc4722f76dcc352d7b1ab8b8288bed4ed2c5"
|
||||
dependencies = [
|
||||
"winapi 0.2.8",
|
||||
"winapi-build",
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2700,3 +2653,23 @@ name = "xdg"
|
|||
version = "2.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546"
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a7af71d8643341260a65f89fa60c0eeaa907f34544d8f6d9b0df72f069b5e74"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9731702e2f0617ad526794ae28fbc6f6ca8849b5ba729666c2a5bc4b6ddee2cd"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.29",
|
||||
]
|
||||
|
|
|
@ -1,7 +1,50 @@
|
|||
# Development
|
||||
|
||||
Code style follows the `rustfmt.toml` file.
|
||||
|
||||
## Trace logs
|
||||
|
||||
Enable trace logs to `stderr` with:
|
||||
|
||||
```sh
|
||||
export MELI_DEBUG_STDERR=yes
|
||||
```
|
||||
|
||||
This means you will have to to redirect `stderr` to a file like `meli 2> trace.log`.
|
||||
|
||||
Tracing is opt-in by build features:
|
||||
|
||||
```sh
|
||||
cargo build --features=debug-tracing,imap-trace,smtp-trace
|
||||
```
|
||||
|
||||
## use `.git-blame-ignore-revs` file _optional_
|
||||
|
||||
Use this file to ignore formatting commits from `git-blame`.
|
||||
It needs to be set up per project because `git-blame` will fail if it's missing.
|
||||
|
||||
```sh
|
||||
git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||
```
|
||||
|
||||
## Formatting with `rustfmt`
|
||||
|
||||
```sh
|
||||
make fmt
|
||||
```
|
||||
|
||||
## Linting with `clippy`
|
||||
|
||||
```sh
|
||||
make lint
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
```sh
|
||||
make test
|
||||
```
|
||||
|
||||
How to run specific tests:
|
||||
|
||||
```sh
|
||||
|
@ -11,14 +54,14 @@ cargo test -p {melib, meli} (-- --nocapture) (--test test_name)
|
|||
## Profiling
|
||||
|
||||
```sh
|
||||
perf record -g target/debug/bin
|
||||
perf record -g target/debug/meli
|
||||
perf script | stackcollapse-perf | rust-unmangle | flamegraph > perf.svg
|
||||
```
|
||||
|
||||
## Running fuzz targets
|
||||
|
||||
Note: `cargo-fuzz` requires the nightly toolchain.
|
||||
|
||||
```sh
|
||||
cargo +nightly fuzz run envelope_parse -- -dict=fuzz/envelope_tokens.dict
|
||||
```
|
||||
<!-- -->
|
||||
<!-- ## Running fuzz targets -->
|
||||
<!-- -->
|
||||
<!-- Note: `cargo-fuzz` requires the nightly toolchain. -->
|
||||
<!-- -->
|
||||
<!-- ```sh -->
|
||||
<!-- cargo +nightly fuzz run envelope_parse -- -dict=fuzz/envelope_tokens.dict -->
|
||||
<!-- ``` -->
|
||||
|
|
105
Makefile
105
Makefile
|
@ -19,13 +19,13 @@
|
|||
.POSIX:
|
||||
.SUFFIXES:
|
||||
CARGO_TARGET_DIR ?= target
|
||||
MIN_RUSTC ?= 1.65.0
|
||||
CARGO_BIN ?= cargo
|
||||
TAGREF_BIN ?= tagref
|
||||
CARGO_ARGS ?=
|
||||
RUSTFLAGS ?= -D warnings -W unreachable-pub -W rust-2021-compatibility
|
||||
CARGO_SORT_BIN = cargo-sort
|
||||
PRINTF = /usr/bin/printf
|
||||
CARGO_HACK_BIN = cargo-hack
|
||||
PRINTF = /usr/bin/printf
|
||||
|
||||
# Options
|
||||
PREFIX ?= /usr/local
|
||||
|
@ -35,13 +35,14 @@ MANDIR ?= ${EXPANDED_PREFIX}/share/man
|
|||
|
||||
# Installation parameters
|
||||
DOCS_SUBDIR ?= meli/docs/
|
||||
MANPAGES ?= meli.1 meli.conf.5 meli-themes.5
|
||||
MANPAGES ?= meli.1 meli.conf.5 meli-themes.5 meli.7
|
||||
FEATURES ?= --features "${MELI_FEATURES}"
|
||||
|
||||
MANPATHS != ACCUM="";for m in `manpath 2> /dev/null | tr ':' ' '`; do if [ -d "$${m}" ]; then REAL_PATH=`cd $${m} && pwd` ACCUM="$${ACCUM}:$${REAL_PATH}";fi;done;echo -n $${ACCUM} | sed 's/^://'
|
||||
VERSION != sed -n "s/^version\s*=\s*\"\(.*\)\"/\1/p" Cargo.toml
|
||||
GIT_COMMIT != git show-ref -s --abbrev HEAD
|
||||
DATE != date -I
|
||||
MANPATHS != ACCUM="";for m in `manpath 2> /dev/null | tr ':' ' '`; do if [ -d "$${m}" ]; then REAL_PATH=`cd $${m} && pwd` ACCUM="$${ACCUM}:$${REAL_PATH}";fi;done;echo $${ACCUM}'\c' | sed 's/^://'
|
||||
VERSION = `grep -m1 version meli/Cargo.toml | head -n1 | cut -d'"' -f 2 | head -n1`
|
||||
MIN_RUSTC = `grep -m1 rust-version meli/Cargo.toml | head -n1 | cut -d'"' -f 2 | head -n1`
|
||||
GIT_COMMIT = `git show-ref -s --abbrev HEAD`
|
||||
DATE = `date -I`
|
||||
|
||||
# Output parameters
|
||||
BOLD ?= `[ -z $${TERM} ] && echo "" || tput bold`
|
||||
|
@ -50,6 +51,7 @@ ANSI_RESET ?= `[ -z $${TERM} ] && echo "" || tput sgr0`
|
|||
CARGO_COLOR ?= `[ -z $${NO_COLOR+x} ] && echo "" || echo "--color=never "`
|
||||
RED ?= `[ -z $${NO_COLOR+x} ] && ([ -z $${TERM} ] && echo "" || tput setaf 1) || echo ""`
|
||||
GREEN ?= `[ -z $${NO_COLOR+x} ] && ([ -z $${TERM} ] && echo "" || tput setaf 2) || echo ""`
|
||||
YELLOW ?= `[ -z $${NO_COLOR+x} ] && ([ -z $${TERM} ] && echo "" || tput setaf 3) || echo ""`
|
||||
|
||||
.PHONY: meli
|
||||
meli: check-deps
|
||||
|
@ -57,12 +59,12 @@ meli: check-deps
|
|||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "For a quick start, build and install locally:\n ${BOLD}${GREEN}PREFIX=~/.local make install${ANSI_RESET}\n"
|
||||
@echo "For a quick start, build and install locally:\n\n${BOLD}${GREEN}make PREFIX=~/.local install${ANSI_RESET}\n"
|
||||
@echo "Available subcommands:"
|
||||
@echo " - ${BOLD}meli${ANSI_RESET} (builds meli with optimizations in \$$CARGO_TARGET_DIR)"
|
||||
@echo " - ${BOLD}install${ANSI_RESET} (installs binary in \$$BINDIR and documentation to \$$MANDIR)"
|
||||
@echo " - ${BOLD}uninstall${ANSI_RESET}"
|
||||
@echo "Secondary subcommands:"
|
||||
@echo "\nSecondary subcommands:"
|
||||
@echo " - ${BOLD}clean${ANSI_RESET} (cleans build artifacts)"
|
||||
@echo " - ${BOLD}check-deps${ANSI_RESET} (checks dependencies)"
|
||||
@echo " - ${BOLD}install-bin${ANSI_RESET} (installs binary to \$$BINDIR)"
|
||||
|
@ -75,24 +77,26 @@ help:
|
|||
@echo " - ${BOLD}build-rustdoc${ANSI_RESET} (builds rustdoc documentation for all packages in \$$CARGO_TARGET_DIR)"
|
||||
@echo "\nENVIRONMENT variables of interest:"
|
||||
@echo "* PREFIX = ${UNDERLINE}${EXPANDED_PREFIX}${ANSI_RESET}"
|
||||
@echo -n "* MELI_FEATURES = ${UNDERLINE}"
|
||||
@[ -z $${MELI_FEATURES+x} ] && echo -n "unset" || echo -n ${MELI_FEATURES}
|
||||
@echo "* MELI_FEATURES = ${UNDERLINE}\n"
|
||||
@[ -z $${MELI_FEATURES+x} ] && echo "unset\c" || echo ${MELI_FEATURES}'\c'
|
||||
@echo ${ANSI_RESET}
|
||||
@echo "* BINDIR = ${UNDERLINE}${BINDIR}${ANSI_RESET}"
|
||||
@echo "* MANDIR = ${UNDERLINE}${MANDIR}${ANSI_RESET}"
|
||||
@echo -n "* MANPATH = ${UNDERLINE}"
|
||||
@[ $${MANPATH+x} ] && echo -n $${MANPATH} || echo -n "unset"
|
||||
@echo "* MANPATH = ${UNDERLINE}\c"
|
||||
@[ $${MANPATH+x} ] && echo $${MANPATH}'\c' || echo "unset\c"
|
||||
@echo ${ANSI_RESET}
|
||||
@echo "* (cleaned) output of manpath(1) = ${UNDERLINE}${MANPATHS}${ANSI_RESET}"
|
||||
@echo -n "* NO_MAN ${UNDERLINE}"
|
||||
@[ $${NO_MAN+x} ] && echo -n "set" || echo -n "unset"
|
||||
@echo "* NO_MAN ${UNDERLINE}\c"
|
||||
@[ $${NO_MAN+x} ] && echo "set\c" || echo "unset\c"
|
||||
@echo ${ANSI_RESET}
|
||||
@echo -n "* NO_COLOR ${UNDERLINE}"
|
||||
@[ $${NO_COLOR+x} ] && echo -n "set" || echo -n "unset"
|
||||
@echo "* NO_COLOR ${UNDERLINE}\c"
|
||||
@[ $${NO_COLOR+x} ] && echo "set\c" || echo "unset\c"
|
||||
@echo ${ANSI_RESET}
|
||||
@echo "* CARGO_BIN = ${UNDERLINE}${CARGO_BIN}${ANSI_RESET}"
|
||||
@echo "* CARGO_ARGS = ${UNDERLINE}${CARGO_ARGS}${ANSI_RESET}"
|
||||
@echo "* MIN_RUSTC = ${UNDERLINE}${MIN_RUSTC}${ANSI_RESET}"
|
||||
@echo "* VERSION = ${UNDERLINE}${VERSION}${ANSI_RESET}"
|
||||
@echo "* GIT_COMMIT = ${UNDERLINE}${GIT_COMMIT}${ANSI_RESET}"
|
||||
@#@echo "* CARGO_COLOR = ${CARGO_COLOR}"
|
||||
|
||||
.PHONY: check
|
||||
|
@ -116,6 +120,10 @@ test: test-docs
|
|||
test-docs:
|
||||
@RUSTFLAGS='${RUSTFLAGS}' ${CARGO_BIN} test ${CARGO_ARGS} ${CARGO_COLOR}--target-dir="${CARGO_TARGET_DIR}" --all --doc
|
||||
|
||||
.PHONY: test-feature-permutations
|
||||
test-feature-permutations:
|
||||
$(CARGO_HACK_BIN) hack --feature-powerset
|
||||
|
||||
.PHONY: check-deps
|
||||
check-deps:
|
||||
@(if ! echo ${MIN_RUSTC}\\n`${CARGO_BIN} --version | grep ^cargo | cut -d ' ' -f 2` | sort -CV; then echo "rust version >= ${RED}${MIN_RUSTC}${ANSI_RESET} required, found: `which ${CARGO_BIN}` `${CARGO_BIN} --version | cut -d ' ' -f 2`" \
|
||||
|
@ -127,30 +135,32 @@ clean:
|
|||
-rm -rf ./${CARGO_TARGET_DIR}/
|
||||
|
||||
.PHONY: distclean
|
||||
distclean: clean
|
||||
distclean:
|
||||
@rm -f meli-${VERSION}.tar.gz
|
||||
@rm -rf .pc # rm debian stuff
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)${BINDIR}/meli
|
||||
-rm $(DESTDIR)${MANDIR}/man1/meli.1.gz
|
||||
-rm $(DESTDIR)${MANDIR}/man5/meli.conf.5.gz
|
||||
-rm $(DESTDIR)${MANDIR}/man5/meli-themes.5.gz
|
||||
for MANPAGE in ${MANPAGES}; do \
|
||||
SECTION=`echo $${MANPAGE} | rev | cut -d "." -f 1`; \
|
||||
MANPAGEPATH="${DESTDIR}${MANDIR}/man$${SECTION}/$${MANPAGE}.gz"; \
|
||||
rm -f "$${MANAGEPATH}"
|
||||
; done
|
||||
|
||||
.PHONY: install-doc
|
||||
install-doc:
|
||||
@(if [ -z $${NO_MAN+x} ]; then \
|
||||
mkdir -p $(DESTDIR)${MANDIR}/man1 ; \
|
||||
mkdir -p $(DESTDIR)${MANDIR}/man5 ; \
|
||||
echo " - ${BOLD}Installing manpages to ${ANSI_RESET}${DESTDIR}${MANDIR}:" ; \
|
||||
for MANPAGE in ${MANPAGES}; do \
|
||||
SECTION=`echo $${MANPAGE} | rev | cut -d "." -f 1`; \
|
||||
mkdir -p $(DESTDIR)${MANDIR}/man$${SECTION} ; \
|
||||
MANPAGEPATH=${DESTDIR}${MANDIR}/man$${SECTION}/$${MANPAGE}.gz; \
|
||||
echo " * installing $${MANPAGE} ā ${GREEN}$${MANPAGEPATH}${ANSI_RESET}"; \
|
||||
gzip -n < ${DOCS_SUBDIR}$${MANPAGE} > $${MANPAGEPATH} \
|
||||
; done ; \
|
||||
(case ":${MANPATHS}:" in \
|
||||
*:${DESTDIR}${MANDIR}:*) echo -n "";; \
|
||||
*:${DESTDIR}${MANDIR}:*) echo "\c";; \
|
||||
*) echo "\n${RED}${BOLD}WARNING${ANSI_RESET}: ${UNDERLINE}Path ${DESTDIR}${MANDIR} is not contained in your MANPATH variable or the output of \`manpath\` command.${ANSI_RESET} \`man\` might fail finding the installed manpages. Consider adding it if necessary.\nMANPATH variable / output of \`manpath\`: ${MANPATHS}" ;; \
|
||||
esac) ; \
|
||||
else echo "NO_MAN is defined, so no documentation is going to be installed." ; fi)
|
||||
|
@ -160,7 +170,7 @@ install-bin: meli
|
|||
@mkdir -p $(DESTDIR)${BINDIR}
|
||||
@echo " - ${BOLD}Installing binary to ${ANSI_RESET}${GREEN}${DESTDIR}${BINDIR}/meli${ANSI_RESET}"
|
||||
@case ":${PATH}:" in \
|
||||
*:${DESTDIR}${BINDIR}:*) echo -n "";; \
|
||||
*:${DESTDIR}${BINDIR}:*) echo "\n";; \
|
||||
*) echo "\n${RED}${BOLD}WARNING${ANSI_RESET}: ${UNDERLINE}Path ${DESTDIR}${BINDIR} is not contained in your PATH variable.${ANSI_RESET} Consider adding it if necessary.\nPATH variable: ${PATH}";; \
|
||||
esac
|
||||
@mkdir -p $(DESTDIR)${BINDIR}
|
||||
|
@ -173,10 +183,11 @@ install-bin: meli
|
|||
.NOTPARALLEL: yes
|
||||
install: meli install-bin install-doc
|
||||
@(if [ -z $${NO_MAN+x} ]; then \
|
||||
echo "\n You're ready to go. You might want to read the \"STARTING WITH meli\" section in the manpage (\`man meli\`)" ;\
|
||||
$(PRINTF) "\n You're ready to go. You might want to read the \"STARTING WITH meli\" section in the manpage (\`man meli\`)" ;\
|
||||
$(PRINTF) "\n or the tutorial in meli(7) (\`man 7 meli\`).\n" ;\
|
||||
fi)
|
||||
@echo " - Report bugs in the mailing list or git issue tracker ${UNDERLINE}https://git.meli.delivery${ANSI_RESET}"
|
||||
@echo " - If you have a specific feature or workflow you want to use, you can post in the mailing list or git issue tracker."
|
||||
@$(PRINTF) " - Report bugs in the mailing list or git issue tracker ${UNDERLINE}https://git.meli-email.org${ANSI_RESET}\n"
|
||||
@$(PRINTF) " - If you have a specific feature or workflow you want to use, you can post in the mailing list or git issue tracker.\n"
|
||||
|
||||
.PHONY: dist
|
||||
dist:
|
||||
|
@ -185,8 +196,9 @@ dist:
|
|||
|
||||
.PHONY: deb-dist
|
||||
deb-dist:
|
||||
@dpkg-buildpackage -b -rfakeroot -us -uc
|
||||
@echo ${BOLD}${GREEN}Generated${ANSI_RESET} ../meli_${VERSION}-1_amd64.deb
|
||||
@author=$(grep -m1 authors meli/Cargo.toml | head -n1 | cut -d'"' -f 2 | head -n1)
|
||||
@dpkg-buildpackage -b -rfakeroot -us -uc --build-by="${author}" --release-by="${author}"
|
||||
@echo ${BOLD}${GREEN}Generated${ANSI_RESET} ../meli_${VERSION}-1_`dpkg --print-architecture`.deb
|
||||
|
||||
.PHONY: build-rustdoc
|
||||
build-rustdoc:
|
||||
|
@ -201,3 +213,36 @@ check-tagrefs:
|
|||
else \
|
||||
$(TAGREF_BIN);\
|
||||
fi)
|
||||
|
||||
.PHONY: test-makefile
|
||||
test-makefile:
|
||||
@$(PRINTF) "Checking that current version is detected. "
|
||||
@([ ! -z "${VERSION}" ] && $(PRINTF) "${GREEN}OK${ANSI_RESET}\n") || $(PRINTF) "${RED}ERROR${ANSI_RESET}\nVERSION env var is empty, check its definition.\n" 1>&2
|
||||
@$(PRINTF) "Checking that 'date -I' works on this platform. "
|
||||
@export DATEVAL=$$(printf "%s" ${DATE} | wc -c | tr -d "[:blank:]" 2>&1); ([ "$${DATEVAL}" = "10" ] && $(PRINTF) "${GREEN}OK${ANSI_RESET}\n") || $(PRINTF) "${RED}ERROR${ANSI_RESET}\n'date -I' does not produce a YYYY-MM-DD output on this platform.\n" 1>&2
|
||||
@$(PRINTF) "Checking that the git commit SHA can be detected. "
|
||||
@([ ! -z "$(GIT_COMMIT)" ] && $(PRINTF) "${GREEN}OK${ANSI_RESET}\n") || $(PRINTF) "${YELLOW}WARN${ANSI_RESET}\nGIT_COMMIT env var is empty.\n" 1>&2
|
||||
|
||||
# Checking if mdoc changes produce new lint warnings from mandoc(1) compared to HEAD version:
|
||||
#
|
||||
# example invocation: `mandoc_lint meli.1`
|
||||
#
|
||||
# with diff(1)
|
||||
# ============
|
||||
#function mandoc_lint () {
|
||||
#diff <(mandoc -T lint <(git show HEAD:./meli/docs/$1) 2> /dev/null | cut -d':' -f 3-) <(mandoc -T lint ./meli/docs/$1 2> /dev/null | cut -d':' -f 3-)
|
||||
#}
|
||||
#
|
||||
# with sdiff(1) (side by side)
|
||||
# ============================
|
||||
#
|
||||
#function mandoc_lint () {
|
||||
#sdiff <(mandoc -T lint <(git show HEAD:./meli/docs/$1) 2> /dev/null | cut -d':' -f 3-) <(mandoc -T lint ./meli/docs/$1 2> /dev/null | cut -d':' -f 3-)
|
||||
#}
|
||||
#
|
||||
# with delta(1)
|
||||
# =============
|
||||
#
|
||||
#function mandoc_lint () {
|
||||
#delta --side-by-side <(mandoc -T lint <(git show HEAD:./meli/docs/$1) 2> /dev/null | cut -d':' -f 3-) <(mandoc -T lint ./meli/docs/$1 2> /dev/null | cut -d':' -f 3-)
|
||||
#}
|
||||
|
|
203
README.md
203
README.md
|
@ -1,53 +1,105 @@
|
|||
# meli [![GitHub license](https://img.shields.io/github/license/meli/meli)](https://github.com/meli/meli/blob/master/COPYING) [![Crates.io](https://img.shields.io/crates/v/meli)](https://crates.io/crates/meli)
|
||||
# meli ![Established, created in 2017](https://img.shields.io/badge/Est.-2017-blue) ![Minimum Supported Rust Version](https://img.shields.io/badge/MSRV-1.68.2-blue) [![GitHub license](https://img.shields.io/github/license/meli/meli)](https://github.com/meli/meli/blob/master/COPYING) [![Crates.io](https://img.shields.io/crates/v/meli)](https://crates.io/crates/meli) [![IRC channel](https://img.shields.io/badge/irc.oftc.net-%23meli-blue)](ircs://irc.oftc.net:6697/%23meli)
|
||||
|
||||
**BSD/Linux terminal email client with support for multiple accounts and Maildir / mbox / notmuch / IMAP / JMAP / NNTP (usenet).**
|
||||
**BSD/Linux/macos terminal email client with support for multiple accounts and Maildir / mbox / notmuch / IMAP / JMAP / NNTP (Usenet).**
|
||||
|
||||
Community links:
|
||||
[mailing lists](https://lists.meli.delivery/) | `#meli` on OFTC IRC | Report bugs and/or feature requests in [meli's issue tracker](https://git.meli.delivery/meli/meli/issues "meli gitea issue tracker")
|
||||
Try an [old online interactive web demo](https://meli-email.org/wasm2.html "online interactive web demo") powered by WebAssembly!
|
||||
|
||||
Main repository: <https://git.meli.delivery/meli/meli>
|
||||
* `#meli` on OFTC IRC | [mailing lists](https://lists.meli-email.org/)
|
||||
* Repository:
|
||||
- Main <https://git.meli-email.org/meli/meli> Report bugs and/or feature requests in [meli's issue tracker](https://git.meli-email.org/meli/meli/issues "meli gitea issue tracker")
|
||||
- Official mirror <https://codeberg.org/meli/meli>
|
||||
- Official mirror <https://github.com/meli/meli>
|
||||
|
||||
Official mirrors: <https://github.com/meli/meli>
|
||||
**Table of contents**:
|
||||
|
||||
- [Install](#install)
|
||||
- [Build](#build)
|
||||
- [Quick start](#quick-start)
|
||||
- [Supported E-mail backends](#supported-e-mail-backends)
|
||||
- [E-mail submission backends](#e-mail-submission-backends)
|
||||
- [Non-exhaustive list of features](#non-exhaustive-list-of-features)
|
||||
- [HTML Rendering](#html-rendering)
|
||||
- [Documentation](#documentation)
|
||||
|
||||
## Install
|
||||
|
||||
- [pkgsrc](https://pkgsrc.se/mail/meli)
|
||||
- [openbsd ports](https://openports.pl/path/mail/meli)
|
||||
- `cargo install meli` or `cargo install --git https://git.meli-email.org/meli/meli.git meli`
|
||||
- [Pre-built debian package, static binaries](https://github.com/meli/meli/releases/ "github releases for meli")
|
||||
- [Nix](https://search.nixos.org/packages?show=meli&query=meli&from=0&size=30&sort=relevance&channel=unstable#disabled "nixos package search results for 'meli'")
|
||||
|
||||
## Build
|
||||
|
||||
Run `cargo build --release --bin meli` or `make`.
|
||||
|
||||
For detailed building instructions, see [`BUILD.md`](./BUILD.md)
|
||||
|
||||
## Quick start
|
||||
|
||||
<table>
|
||||
<tr><td>
|
||||
|
||||
```sh
|
||||
# Create configuration file in ${XDG_CONFIG_HOME}/meli/config.toml:
|
||||
$ meli create-config
|
||||
# Edit configuration in ${EDITOR} or ${VISUAL}:
|
||||
$ meli edit-config
|
||||
# Optionally, install manual pages if installed via cargo:
|
||||
$ meli install-man
|
||||
# Ready to go.
|
||||
$ meli
|
||||
```
|
||||
|
||||
</td><td>
|
||||
|
||||
See a comprehensive tour of `meli` in the manual page [`meli(7)`](./meli/docs/meli.7).
|
||||
|
||||
See also the [Quickstart tutorial](https://meli-email.org/documentation.html#quick-start) online.
|
||||
|
||||
After installing `meli`, see `meli(1)`, `meli.conf(5)`, `meli(7)` and `meli-themes(5)` for documentation.
|
||||
Sample configuration and theme files can be found in the `meli/docs/samples/` subdirectory.
|
||||
Manual pages are also [hosted online](https://meli-email.org/documentation.html "meli documentation").
|
||||
`meli` by default looks for a configuration file in this location: `${XDG_CONFIG_HOME}/meli/config.toml`.
|
||||
|
||||
You can run meli with arbitrary configuration files by setting the `${MELI_CONFIG}` environment variable to their locations, i.e.:
|
||||
|
||||
```sh
|
||||
MELI_CONFIG=./test_config cargo run
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
See [`meli(7)`](./meli/docs/meli.7) for an extensive tutorial and [`meli.conf(5)`](./meli/docs/meli.conf.5) for all configuration values.
|
||||
|
||||
| | | |
|
||||
:---:|:---:|:---:
|
||||
![Main view screenshot](./meli/docs/screenshots/main.webp "mail meli view screenshot") | ![Compact main view screenshot](./meli/docs/screenshots/compact.webp "compact main view screenshot") | ![Compose with embed terminal editor screenshot](./meli/docs/screenshots/compose.webp "composing view screenshot")
|
||||
Main view | Compact main view | Compose with embed terminal editor
|
||||
|
||||
## Description
|
||||
|
||||
meli aims for configurability, extensibility with sane defaults, and modern
|
||||
practices. It is a mail client for both casual and power users of the terminal.
|
||||
|
||||
A variety of email workflows and software stacks should be usable with meli.
|
||||
Integrate e-mail storage, sync, tagging system, SMTP client, contact management
|
||||
and editor of your choice to replace the defaults.
|
||||
|
||||
|
||||
### Supported E-mail backends
|
||||
|
||||
| Protocol | Support |
|
||||
|:------------:|:----------------|
|
||||
| IMAP | full |
|
||||
| Maildir | full |
|
||||
| notmuch | full* |
|
||||
| notmuch | full[^0] |
|
||||
| mbox | read-only |
|
||||
| JMAP | functional |
|
||||
| NNTP / Usenet| functional |
|
||||
|
||||
[^0]: there's no support for searching through all email directly, you'd have to
|
||||
create a mailbox with a notmuch query that returns everything and search
|
||||
inside that mailbox.
|
||||
|
||||
* there's no support for searching through all email directly, you'd have to
|
||||
create a mailbox with a notmuch query that returns everything and search
|
||||
inside that mailbox.
|
||||
|
||||
### E-mail Submission backends
|
||||
--------------------------
|
||||
### E-mail submission backends
|
||||
|
||||
- SMTP
|
||||
- Pipe to shell script
|
||||
- Server-side submission
|
||||
- Server-side submission when supported
|
||||
|
||||
### Non-exhaustive List of Features
|
||||
### Non-exhaustive list of features
|
||||
|
||||
- TLS
|
||||
- email threading support
|
||||
|
@ -70,93 +122,32 @@ and editor of your choice to replace the defaults.
|
|||
- GPG signing, encryption, signing + encryption
|
||||
- GPG signature verification
|
||||
|
||||
## Install
|
||||
- Try an [online interactive web demo](https://meli.delivery/wasm2.html "online interactive web demo") powered by WebAssembly
|
||||
- Pre-built binaries for [pkgsrc](https://pkgsrc.se/mail/meli) and [openbsd ports](https://openports.pl/path/mail/meli).
|
||||
- `cargo install --git https://git.meli.delivery/meli/meli.git meli`
|
||||
- [Download and install pre-built debian package, static linux binary](https://github.com/meli/meli/releases/ "github releases for meli"), or
|
||||
- Install with [Nix](https://search.nixos.org/packages?show=meli&query=meli&from=0&size=30&sort=relevance&channel=unstable#disabled "nixos package search results for 'meli'").
|
||||
## Documentation
|
||||
|
||||
See a comprehensive tour of `meli` in the manual page [`meli(7)`](./meli/docs/meli.7).
|
||||
|
||||
See also the [Quickstart tutorial](https://meli.delivery/documentation.html#quick-start) online.
|
||||
|
||||
After installing `meli`, see `meli(1)`, `meli.conf(5)`, `meli(7)` and `meli-themes(5)` for documentation.
|
||||
Sample configuration and theme files can be found in the `meli/docs/samples/` subdirectory.
|
||||
Manual pages are also [hosted online](https://meli.delivery/documentation.html "meli documentation").
|
||||
|
||||
`meli` by default looks for a configuration file in this location: `$XDG_CONFIG_HOME/meli/config.toml`
|
||||
|
||||
You can run meli with arbitrary configuration files by setting the `$MELI_CONFIG` environment variable to their locations, i.e.:
|
||||
|
||||
```sh
|
||||
MELI_CONFIG=./test_config cargo run
|
||||
```
|
||||
|
||||
## Build
|
||||
For a quick start, build and install locally:
|
||||
|
||||
```sh
|
||||
PREFIX=~/.local make install
|
||||
```
|
||||
|
||||
Available subcommands for `make` are listed with `make help`.
|
||||
The Makefile *should* be POSIX portable and not require a specific `make` version.
|
||||
|
||||
`meli` requires rust 1.65 and rust's package manager, Cargo.
|
||||
Information on how to get it on your system can be found here: <https://doc.rust-lang.org/cargo/getting-started/installation.html>
|
||||
|
||||
With Cargo available, the project can be built with `make` and the resulting binary will then be found under `target/release/meli`.
|
||||
Run `make install` to install the binary and man pages.
|
||||
This requires root, so I suggest you override the default paths and install it in your `$HOME`: `make PREFIX=$HOME/.local install`.
|
||||
|
||||
You can build and run `meli` with one command: `cargo run --release`.
|
||||
|
||||
### Build features
|
||||
|
||||
Some functionality is held behind "feature gates", or compile-time flags. The following list explains each feature's purpose:
|
||||
|
||||
- `gpgme` enables GPG support via `libgpgme` (on by default)
|
||||
- `dbus-notifications` enables showing notifications using `dbus` (on by default)
|
||||
- `notmuch` provides support for using a notmuch database as a mail backend (on by default)
|
||||
- `jmap` provides support for connecting to a jmap server and use it as a mail backend (on by default)
|
||||
- `sqlite3` provides support for builting fast search indexes in local sqlite3 databases (on by default)
|
||||
- `cli-docs` includes the manpage documentation compiled by either `mandoc` or `man` binary to plain text in `meli`'s command line. Embedded documentation can be viewed with the subcommand `meli man [PAGE]` (on by default).
|
||||
|
||||
### Build Debian package (*deb*)
|
||||
|
||||
Building with Debian's packaged cargo might require the installation of these two packages: `librust-openssl-sys-dev librust-libdbus-sys-dev`
|
||||
|
||||
A `*.deb` package can be built with `make deb-dist`
|
||||
|
||||
### Using notmuch
|
||||
|
||||
To use the optional notmuch backend feature, you must have `libnotmuch5` installed in your system.
|
||||
In Debian-like systems, install the `libnotmuch5` packages.
|
||||
`meli` detects the library's presence on runtime.
|
||||
|
||||
### Using GPG
|
||||
|
||||
To use the optional gpg feature, you must have `libgpgme` installed in your system.
|
||||
In Debian-like systems, install the `libgpgme11` package.
|
||||
`meli` detects the library's presence on runtime.
|
||||
|
||||
### HTML Rendering
|
||||
## HTML Rendering
|
||||
|
||||
HTML rendering is achieved using [w3m](https://github.com/tats/w3m) by default.
|
||||
You can use the `pager.html_filter` setting to override this (for more details you can consult [`meli.conf(5)`](./meli/docs/meli.conf.5)).
|
||||
|
||||
# Development
|
||||
|
||||
Development builds can be built and/or run with
|
||||
## Documentation
|
||||
|
||||
```
|
||||
cargo build
|
||||
cargo run
|
||||
See a comprehensive tour of `meli` in the manual page [`meli(7)`](./meli/docs/meli.7).
|
||||
|
||||
See also the [Quickstart tutorial](https://meli-email.org/documentation.html#quick-start) online.
|
||||
|
||||
After installing `meli`, see `meli(1)`, `meli.conf(5)`, `meli(7)` and `meli-themes(5)` for documentation.
|
||||
Sample configuration and theme files can be found in the `meli/docs/samples/` subdirectory.
|
||||
Manual pages are also [hosted online](https://meli-email.org/documentation.html "meli documentation").
|
||||
|
||||
`meli` by default looks for a configuration file in this location: `${XDG_CONFIG_HOME}/meli/config.toml`
|
||||
|
||||
You can run meli with arbitrary configuration files by setting the `${MELI_CONFIG}` environment variable to their locations, or use the `[-c, --config]` argument:
|
||||
|
||||
```sh
|
||||
MELI_CONFIG=./test_config meli
|
||||
```
|
||||
|
||||
There is a debug/tracing log feature that can be enabled by using the flag `--feature debug-tracing` after uncommenting the features in `Cargo.toml`.
|
||||
The logs are printed in stderr when the env var `MELI_DEBUG_STDERR` is defined, thus you can run `meli` with a redirection (i.e `2> log`).
|
||||
or
|
||||
|
||||
Code style follows the `rustfmt.toml` file.
|
||||
```sh
|
||||
meli -c ./test_config
|
||||
```
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
# configuration for https://github.com/orhun/git-cliff
|
||||
|
||||
[changelog]
|
||||
# changelog header
|
||||
header = """
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
"""
|
||||
# template for the changelog body
|
||||
# https://keats.github.io/tera/docs/#introduction
|
||||
# note that the - before / after the % controls whether whitespace is rendered between each line.
|
||||
# Getting this right so that the markdown renders with the correct number of lines between headings
|
||||
# code fences and list items is pretty finicky. Note also that the 4 backticks in the commit macro
|
||||
# is intentional as this escapes any backticks in the commit body.
|
||||
body = """
|
||||
|
||||
{% if not version %}
|
||||
## [Unreleased]
|
||||
{% else %}
|
||||
## [{{ version }}](https://git.meli-email.org/meli/meli/releases/tag/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||
{% endif %}
|
||||
{% macro commit(commit) -%}
|
||||
- [{{ commit.id | truncate(length=8, end="") }}]({{ "https://git.meli-email.org/meli/meli/commit/" ~ commit.id }}) {% if commit.scope %}*({{commit.scope | lower }})* {% endif %}{{ commit.message | split(pat="\n")| first | upper_first }}{% endmacro -%}
|
||||
{% for group, commits in commits | group_by(attribute="group") %}
|
||||
|
||||
### {{ group | striptags | trim | upper_first }}
|
||||
{% for commit in commits | filter(attribute="scope") | sort(attribute="scope") %}
|
||||
{{ self::commit(commit=commit) }}
|
||||
{%- endfor -%}
|
||||
{% for commit in commits %}
|
||||
{%- if not commit.scope %}
|
||||
{{ self::commit(commit=commit) }}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endfor %}
|
||||
"""
|
||||
|
||||
# remove the leading and trailing whitespace from the template
|
||||
trim = true
|
||||
# changelog footer
|
||||
footer = """
|
||||
|
||||
|
||||
<!-- generated by git-cliff <https://git-cliff.org> -->
|
||||
"""
|
||||
|
||||
[git]
|
||||
# parse the commits based on https://www.conventionalcommits.org
|
||||
conventional_commits = true
|
||||
# filter out the commits that are not conventional
|
||||
filter_unconventional = false
|
||||
# process each line of a commit as an individual commit
|
||||
split_commits = false
|
||||
# regex for preprocessing the commit messages
|
||||
commit_preprocessors = [
|
||||
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://git.meli-email.org/meli/meli/issues/${2}))" },
|
||||
]
|
||||
# regex for parsing and grouping commits
|
||||
commit_parsers = [
|
||||
{ message = "^feat", group = "<!-- 00 -->Added" },
|
||||
{ message = "^[aA]dd", group = "<!-- 00 -->Added" },
|
||||
{ message = "[fF]ix", group = "<!-- 01 -->Bug Fixes" },
|
||||
{ message = "[rR]efactor", group = "<!-- 02 -->Refactoring" },
|
||||
{ message = "[mM]ove", group = "<!-- 02 -->Refactoring" },
|
||||
{ message = "[rR]emove", group = "<!-- 02 -->Refactoring" },
|
||||
{ message = "^refactor", group = "<!-- 02 -->Refactoring" },
|
||||
{ message = "^[^.]*.rs:", group = "<!-- 02 -->Refactoring" },
|
||||
{ message = "^meli", group = "<!-- 07 -->Miscellaneous Tasks" },
|
||||
{ message = "^melib", group = "<!-- 07 -->Miscellaneous Tasks" },
|
||||
{ message = "^imap", group = "<!-- 07 -->Miscellaneous Tasks" },
|
||||
{ message = "^jmap", group = "<!-- 07 -->Miscellaneous Tasks" },
|
||||
{ message = "^notmuch", group = "<!-- 07 -->Miscellaneous Tasks" },
|
||||
{ message = "^mbox", group = "<!-- 07 -->Miscellaneous Tasks" },
|
||||
{ message = "^smtp", group = "<!-- 07 -->Miscellaneous Tasks" },
|
||||
{ message = "^mbox", group = "<!-- 07 -->Miscellaneous Tasks" },
|
||||
{ message = "^doc", group = "<!-- 03 -->Documentation" },
|
||||
{ message = "[mM]anual", group = "<!-- 03 -->Documentation" },
|
||||
{ message = "[mM]anpage", group = "<!-- 03 -->Documentation" },
|
||||
{ message = "[rR]eadme", group = "<!-- 03 -->Documentation" },
|
||||
{ message = "^perf", group = "<!-- 04 -->Performance" },
|
||||
{ message = "^style", group = "<!-- 05 -->Styling" },
|
||||
{ message = "^test", group = "<!-- 06 -->Testing" },
|
||||
{ message = "^debian", group = "<!-- 06 -->Packaging" },
|
||||
{ message = "^mail/view", group = "<!-- 02 -->Changes" },
|
||||
{ message = "^view", group = "<!-- 02 -->Changes" },
|
||||
{ message = "^utilities", group = "<!-- 02 -->Changes" },
|
||||
{ message = "^mail", group = "<!-- 02 -->Changes" },
|
||||
{ message = "^listing", group = "<!-- 02 -->Changes" },
|
||||
{ message = "^terminal", group = "<!-- 02 -->Changes" },
|
||||
{ message = "^types", group = "<!-- 02 -->Changes" },
|
||||
{ message = "^conf", group = "<!-- 02 -->Changes" },
|
||||
{ message = "^chore\\(release\\): prepare for", skip = true },
|
||||
{ message = "^chore\\(pr\\)", skip = true },
|
||||
{ message = "^chore\\(pull\\)", skip = true },
|
||||
{ message = "^chore\\(deps\\)", skip = true },
|
||||
{ message = "^chore\\(changelog\\)", skip = true },
|
||||
{ message = "^[cC]hore", group = "<!-- 07 -->Miscellaneous Tasks" },
|
||||
{ message = "^scripts", group = "<!-- 07 -->Miscellaneous Tasks" },
|
||||
{ body = ".*security", group = "<!-- 08 -->Security" },
|
||||
{ message = "^build", group = "<!-- 09 -->Build" },
|
||||
{ message = "^ci", group = "<!-- 10 -->Continuous Integration" },
|
||||
{ message = "^revert", group = "<!-- 11 -->Reverted Commits" },
|
||||
{ message = ".*", group = "<!-- 07 -->Miscellaneous Tasks" },
|
||||
]
|
||||
# protect breaking changes from being skipped due to matching a skipping commit_parser
|
||||
protect_breaking_commits = false
|
||||
# filter out the commits that are not matched by commit parsers
|
||||
filter_commits = false
|
||||
# glob pattern for matching git tags
|
||||
tag_pattern = "v[0-9]+|alpha-[0-9]+"
|
||||
# regex for ignoring tags
|
||||
ignore_tags = "v[^-]+-rc[.]?[0-9]+"
|
||||
# regex for skipping tags
|
||||
#skip_tags = "alpha"
|
||||
# sort the tags topologically
|
||||
topo_order = false
|
||||
# sort the commits inside sections by oldest/newest order
|
||||
sort_commits = "oldest"
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"@context": ["https://doi.org/10.5063/schema/codemeta-2.0", "http://schema.org/"],
|
||||
"@type": "SoftwareSourceCode",
|
||||
"applicationCategory": "E-mail client",
|
||||
"author": [
|
||||
{
|
||||
"@id": "https://pitsidianak.is/",
|
||||
"@type": "Person",
|
||||
"name": "epilys",
|
||||
"email": "manos@pitsidianak.is",
|
||||
"familyName": "Pitsidianakis",
|
||||
"givenName": "Manos",
|
||||
"url": "https://pitsidianak.is/"
|
||||
}
|
||||
],
|
||||
"codeRepository": "https://git.meli-email.org/meli/meli.git",
|
||||
"dateCreated": "2016-04-25",
|
||||
"dateModified": "2023-12-11",
|
||||
"datePublished": "2017-07-23",
|
||||
"description": "BSD/Linux/macos terminal email client with support for multiple accounts and Maildir / mbox / notmuch / IMAP / JMAP / NNTP (Usenet).",
|
||||
"downloadUrl": "https://git.meli-email.org/meli/meli/archive/v0.8.5-rc.3.tar.gz",
|
||||
"identifier": "https://meli-email.org/",
|
||||
"isPartOf": "https://meli-email.org/",
|
||||
"keywords": [
|
||||
"e-mail",
|
||||
"email",
|
||||
"mail",
|
||||
"terminal user interface",
|
||||
"client",
|
||||
"mua",
|
||||
"mail user agent",
|
||||
"smtp",
|
||||
"imap",
|
||||
"jmap",
|
||||
"mbox",
|
||||
"maildir",
|
||||
"nntp"
|
||||
],
|
||||
"license": [
|
||||
"https://spdx.org/licenses/EUPL-1.2",
|
||||
"https://spdx.org/licenses/GPL-3.0-or-later"
|
||||
],
|
||||
"name": "meli",
|
||||
"operatingSystem": [
|
||||
"Linux",
|
||||
"macOS",
|
||||
"OpenBSD",
|
||||
"NetBSD"
|
||||
],
|
||||
"programmingLanguage": "Rust",
|
||||
"relatedLink": [
|
||||
"https://codeberg.org/meli/meli",
|
||||
"https://github.com/meli/meli",
|
||||
"https://lists.meli-email.org/"
|
||||
],
|
||||
"version": "0.8.5-rc3",
|
||||
"contIntegration": "https://git.meli-email.org/meli/meli/actions",
|
||||
"developmentStatus": "active",
|
||||
"issueTracker": "https://git.meli-email.org/meli/meli/issues",
|
||||
"readme": "https://git.meli-email.org/meli/meli/raw/commit/dedee908d1e0b42773bade8e0604e94b14810e2d/README.md",
|
||||
"buildInstructions": "https://git.meli-email.org/meli/meli/raw/commit/dedee908d1e0b42773bade8e0604e94b14810e2d/BUILD.md"
|
||||
}
|
|
@ -1,3 +1,21 @@
|
|||
meli (0.8.5-rc.3-1) bookworm; urgency=low
|
||||
|
||||
* Update to 0.8.5-rc.3
|
||||
|
||||
-- Manos Pitsidianakis <manos@pitsidianak.is> Sun, 10 Dec 2023 15:22:18 +0000
|
||||
|
||||
meli (0.8.5-rc.2-1) bookworm; urgency=low
|
||||
|
||||
* Update to 0.8.5-rc.2
|
||||
|
||||
-- Manos Pitsidianakis <manos@pitsidianak.is> Mon, 4 Dec 2023 19:34:00 +0200
|
||||
|
||||
meli (0.8.4-1) bookworm; urgency=low
|
||||
|
||||
* Update to 0.8.4
|
||||
|
||||
-- Manos Pitsidianakis <manos@pitsidianak.is> Mon, 27 Nov 2023 19:34:00 +0200
|
||||
|
||||
meli (0.7.2-1) bullseye; urgency=low
|
||||
Added
|
||||
|
||||
|
@ -25,7 +43,7 @@ meli (0.7.1-1) bullseye; urgency=low
|
|||
- melib/nntp: implement refresh
|
||||
- melib/nntp: update total/new counters on new articles
|
||||
- melib/nntp: implement NNTP posting
|
||||
- configs: throw error on extra unusued conf flags in some imap/nntp
|
||||
- configs: throw error on extra unused conf flags in some imap/nntp
|
||||
- configs: throw error on missing `composing` section with explanation
|
||||
|
||||
Fixed
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
11
|
|
@ -1,14 +1,20 @@
|
|||
Source: meli
|
||||
Section: mail
|
||||
Priority: optional
|
||||
Maintainer: Manos Pitsidianakis <epilys@nessuent.xyz>
|
||||
Build-Depends: debhelper (>=11~), mandoc (>=1.14.4-1), quilt, libsqlite3-dev
|
||||
Maintainer: Manos Pitsidianakis <manos@pitsidianak.is>
|
||||
Build-Depends: debhelper-compat (=13), mandoc (>=1.14.4-1), quilt, libsqlite3-dev
|
||||
Standards-Version: 4.1.4
|
||||
Homepage: https://meli.delivery
|
||||
Rules-Requires-Root: no
|
||||
Vcs-Git: https://git.meli-email.org/meli/meli.git
|
||||
Vcs-Browser: https://git.meli-email.org/meli/meli
|
||||
Homepage: https://meli-email.org
|
||||
|
||||
Package: meli
|
||||
Architecture: any
|
||||
Multi-Arch: foreign
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Recommends: libnotmuch, xdg-utils (>=1.1.3-1)
|
||||
Description: terminal mail client
|
||||
Recommends: xdg-utils (>=1.1.3-1), w3m, mailcap
|
||||
Suggests: libnotmuch5, notmuch, rss2email, xterm, neovim, msmtp
|
||||
Provides: mail-reader, imap-client
|
||||
Description: terminal mail client.
|
||||
meli supports mbox, maildir, IMAP, JMAP, notmuch and NNTP (Usernet) with
|
||||
TLS/SSL, SASL, GPG features.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: meli
|
||||
Source: <https://git.meli.delivery/meli/meli>
|
||||
Source: https://git.meli-email.org/meli/meli
|
||||
#
|
||||
# Please double check copyright with the licensecheck(1) command.
|
||||
|
||||
Files: *
|
||||
Copyright: 2017-2020 Manos Pitsidianakis
|
||||
Copyright: 2017-2023 Manos Pitsidianakis
|
||||
License: GPL-3.0+
|
||||
#----------------------------------------------------------------------------
|
||||
# License file: COPYING
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
[Desktop Entry]
|
||||
Name=meli
|
||||
Exec=meli
|
||||
Categories=Office;Network;Email;
|
||||
Comment=Terminal mail client
|
||||
NoDisplay=false
|
||||
Terminal=true
|
||||
Type=Application
|
|
@ -0,0 +1,7 @@
|
|||
WARNING: This package is not distributed by debian, it was generated from the source repository of meli.
|
||||
|
||||
Please do not report bugs to debian, but to the appropriate issue tracker for meli:
|
||||
|
||||
- https://git.meli-email.org/meli/meli/issues
|
||||
- Send e-mail to the mailing list, "meli general" <meli-general@meli-email.org>
|
||||
https://lists.meli-email.org/list/meli-general/
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Including output of \`meli -v\` and \`meli compiled-with\`..."
|
||||
|
||||
LC_ALL=C meli -v >&3
|
||||
|
||||
echo "\nEnabled compile-time features"
|
||||
echo "-----------------------------"
|
||||
LC_ALL=C meli compiled-with >&3 || true
|
|
@ -0,0 +1,5 @@
|
|||
Document: meli
|
||||
Title: meli E-mail Client Manual
|
||||
Author: Various
|
||||
Abstract: Manual for meli the terminal e-mail client.
|
||||
Section: Network/Communication
|
|
@ -1,3 +1,4 @@
|
|||
docs/meli.1
|
||||
docs/meli.conf.5
|
||||
docs/meli-themes.5
|
||||
meli/docs/meli.1
|
||||
meli/docs/meli.7
|
||||
meli/docs/meli.conf.5
|
||||
meli/docs/meli-themes.5
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
meli/docs/samples/sample-config.toml
|
||||
meli/docs/samples/themes
|
|
@ -1 +1,2 @@
|
|||
fix-prefix-for-debian.patch
|
||||
usr_bin_editor.patch
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
From: Manos Pitsidianakis <manos@pitsidianak.is>
|
||||
Date: Thu, 27 Feb 2014 16:06:15 +0100
|
||||
Subject: usr_bin_editor
|
||||
|
||||
If EDITOR or VISUAL is not set, fall back to /usr/bin/editor,
|
||||
which is set by update-alternatives.
|
||||
---
|
||||
meli/src/subcommands.rs | 1 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
--- a/meli/src/subcommands.rs
|
||||
+++ b/meli/src/subcommands.rs
|
||||
@@ -52,9 +52,7 @@
|
||||
pub fn edit_config() -> Result<()> {
|
||||
let editor = std::env::var("EDITOR")
|
||||
.or_else(|_| std::env::var("VISUAL"))
|
||||
- .map_err(|err| {
|
||||
- format!("Could not find any value in environment variables EDITOR and VISUAL. {err}")
|
||||
- })?;
|
||||
+ .unwrap_or_else(|_| "/usr/bin/editor".into());
|
||||
let config_path = crate::conf::get_config_file()?;
|
||||
|
||||
let mut cmd = Command::new(editor);
|
|
@ -1,14 +1,21 @@
|
|||
#!/usr/bin/make -f
|
||||
# You must remove unused comment lines for the released package.
|
||||
#export DH_VERBOSE = 1
|
||||
export RUSTUP_HOME=${HOME}/.rustup
|
||||
export DH_VERBOSE = 1
|
||||
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
|
||||
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
|
||||
export MELI_FEATURES = cli-docs sqlite3
|
||||
#export MELI_FEATURES = cli-docs sqlite3
|
||||
|
||||
%:
|
||||
dh $@ --with quilt
|
||||
|
||||
override_dh_auto_configure:
|
||||
true
|
||||
|
||||
override_dh_auto_test:
|
||||
true
|
||||
|
||||
#override_dh_auto_install:
|
||||
# dh_auto_install -- prefix=/usr
|
||||
|
||||
|
|
|
@ -8,17 +8,14 @@ edition = "2018"
|
|||
[package.metadata]
|
||||
cargo-fuzz = true
|
||||
|
||||
[[bin]]
|
||||
name = "envelope_parse"
|
||||
path = "fuzz_targets/envelope_parse.rs"
|
||||
|
||||
[dependencies]
|
||||
libfuzzer-sys = "0.3"
|
||||
|
||||
[dependencies.melib]
|
||||
path = "../melib"
|
||||
features = ["unicode-algorithms"]
|
||||
melib = { path = "../melib" }
|
||||
|
||||
# Prevent this from interfering with workspaces
|
||||
[workspace]
|
||||
members = ["."]
|
||||
|
||||
[[bin]]
|
||||
name = "envelope_parse"
|
||||
path = "fuzz_targets/envelope_parse.rs"
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
[package]
|
||||
name = "meli"
|
||||
version = "0.8.2"
|
||||
version = "0.8.5-rc.3"
|
||||
authors = ["Manos Pitsidianakis <manos@pitsidianak.is>"]
|
||||
edition = "2021"
|
||||
rust-version = "1.65.0"
|
||||
|
||||
rust-version = "1.68.2"
|
||||
license = "GPL-3.0-or-later"
|
||||
readme = "README.md"
|
||||
description = "terminal mail client"
|
||||
homepage = "https://meli.delivery"
|
||||
repository = "https://git.meli.delivery/meli/meli.git"
|
||||
description = "terminal e-mail client"
|
||||
homepage = "https://meli-email.org"
|
||||
repository = "https://git.meli-email.org/meli/meli.git"
|
||||
keywords = ["mail", "mua", "maildir", "terminal", "imap"]
|
||||
categories = ["command-line-utilities", "email"]
|
||||
default-run = "meli"
|
||||
|
@ -22,11 +21,6 @@ path = "src/main.rs"
|
|||
name = "meli"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "managesieve-client"
|
||||
path = "src/managesieve.rs"
|
||||
required-features = ["melib/imap"]
|
||||
|
||||
[dependencies]
|
||||
async-task = "^4.2.0"
|
||||
bitflags = { version = "2.4", features = ["serde"] }
|
||||
|
@ -35,27 +29,51 @@ flate2 = { version = "1", optional = true }
|
|||
futures = "0.3.5"
|
||||
indexmap = { version = "^1.6", features = ["serde-1"] }
|
||||
libc = { version = "0.2.125", default-features = false, features = ["extra_traits"] }
|
||||
linkify = { version = "^0.8", default-features = false }
|
||||
melib = { path = "../melib", version = "0.8.2" }
|
||||
nix = { version = "^0.24", default-features = false }
|
||||
notify = { version = "4.0.1", default-features = false } # >:c
|
||||
num_cpus = "1.12.0"
|
||||
pcre2 = { version = "0.2.3", optional = true }
|
||||
|
||||
libz-sys = { version = "1.1", features = ["static"], optional = true }
|
||||
linkify = { version = "^0.10", default-features = false }
|
||||
melib = { path = "../melib", version = "0.8.5-rc.3", features = [] }
|
||||
nix = { version = "0.27", default-features = false, features = ["signal", "poll", "term", "ioctl", "process"] }
|
||||
serde = "1.0.71"
|
||||
serde_derive = "1.0.71"
|
||||
serde_json = "1.0"
|
||||
signal-hook = { version = "^0.3", default-features = false }
|
||||
signal-hook = { version = "^0.3", default-features = false, features = ["iterator"] }
|
||||
signal-hook-registry = { version = "1.2.0", default-features = false }
|
||||
smallvec = { version = "^1.5.0", features = ["serde"] }
|
||||
structopt = { version = "0.3.14", default-features = false }
|
||||
svg_crate = { version = "^0.13", optional = true, package = "svg" }
|
||||
termion = { version = "1.5.1", default-features = false }
|
||||
toml = { version = "0.5.6", default-features = false, features = ["preserve_order"] }
|
||||
toml = { version = "0.8", default-features = false, features = ["display","preserve_order","parse"] }
|
||||
xdg = "2.1.0"
|
||||
|
||||
[target.'cfg(target_os="linux")'.dependencies]
|
||||
notify-rust = { version = "^4", default-features = false, features = ["dbus"], optional = true }
|
||||
[dependencies.pcre2]
|
||||
# An [env] entry in .cargo/config.toml should force a static build instead of
|
||||
# looking for a system library.
|
||||
version = "0.2.3"
|
||||
optional = true
|
||||
|
||||
[features]
|
||||
default = ["sqlite3", "notmuch", "smtp", "dbus-notifications", "gpgme", "cli-docs", "jmap", "static"]
|
||||
notmuch = ["melib/notmuch"]
|
||||
jmap = ["melib/jmap"]
|
||||
sqlite3 = ["melib/sqlite3"]
|
||||
smtp = ["melib/smtp"]
|
||||
smtp-trace = ["smtp", "melib/smtp-trace"]
|
||||
regexp = ["dep:pcre2"]
|
||||
dbus-notifications = ["dep:notify-rust"]
|
||||
cli-docs = ["dep:flate2"]
|
||||
svgscreenshot = ["dep:svg_crate"]
|
||||
gpgme = ["melib/gpgme"]
|
||||
# Static / vendoring features.
|
||||
tls-static = ["melib/tls-static"]
|
||||
http-static = ["melib/http-static"]
|
||||
sqlite3-static = ["melib/sqlite3-static"]
|
||||
dbus-static = ["dep:notify-rust", "notify-rust?/d_vendored"]
|
||||
libz-static = ["dep:libz-sys", "libz-sys?/static"]
|
||||
static = ["tls-static", "http-static", "sqlite3-static", "dbus-static", "libz-static"]
|
||||
|
||||
# Print tracing logs as meli runs in stderr
|
||||
# enable for debug tracing logs: build with --features=debug-tracing and export MELI_DEBUG_STDERR
|
||||
debug-tracing = ["melib/debug-tracing"]
|
||||
|
||||
[build-dependencies]
|
||||
flate2 = { version = "1", optional = true }
|
||||
|
@ -69,25 +87,5 @@ flate2 = { version = "1" }
|
|||
regex = "1"
|
||||
tempfile = "3.3"
|
||||
|
||||
[features]
|
||||
default = ["sqlite3", "notmuch", "regexp", "smtp", "dbus-notifications", "gpgme", "cli-docs", "jmap", "text-processing"]
|
||||
notmuch = ["melib/notmuch"]
|
||||
jmap = ["melib/jmap"]
|
||||
sqlite3 = ["melib/sqlite3"]
|
||||
smtp = ["melib/smtp"]
|
||||
smtp-trace = ["smtp", "melib/smtp-trace"]
|
||||
regexp = ["pcre2"]
|
||||
dbus-notifications = ["notify-rust"]
|
||||
cli-docs = ["flate2"]
|
||||
svgscreenshot = ["svg_crate"]
|
||||
text-processing = ["melib/unicode-algorithms"]
|
||||
gpgme = ["melib/gpgme"]
|
||||
# Static / vendoring features.
|
||||
tls-static = ["melib/tls-static"]
|
||||
http-static = ["melib/http-static"]
|
||||
sqlite3-static = ["melib/sqlite3-static"]
|
||||
static = ["tls-static", "http-static", "sqlite3-static"]
|
||||
|
||||
# Print tracing logs as meli runs in stderr
|
||||
# enable for debug tracing logs: build with --features=debug-tracing and export MELI_DEBUG_STDERR
|
||||
debug-tracing = ["melib/debug-tracing"]
|
||||
[target.'cfg(target_os="linux")'.dependencies]
|
||||
notify-rust = { version = "^4", default-features = false, features = ["dbus"], optional = true }
|
||||
|
|
|
@ -22,12 +22,11 @@
|
|||
extern crate proc_macro;
|
||||
extern crate quote;
|
||||
extern crate syn;
|
||||
mod config_macros;
|
||||
include!("config_macros.rs");
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed=src/conf/.rebuild.overrides.rs");
|
||||
config_macros::override_derive(&[
|
||||
override_derive(&[
|
||||
("src/conf/pager.rs", "PagerSettings"),
|
||||
("src/conf/listing.rs", "ListingSettings"),
|
||||
("src/conf/notifications.rs", "NotificationsSettings"),
|
||||
|
@ -40,7 +39,7 @@ fn main() {
|
|||
{
|
||||
use flate2::{Compression, GzBuilder};
|
||||
const MANDOC_OPTS: &[&str] = &["-T", "utf8", "-I", "os=Generated by mandoc(1)"];
|
||||
use std::{env, fs::File, io::prelude::*, path::Path, process::Command};
|
||||
use std::{env, io::prelude::*, path::Path};
|
||||
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
let mut out_dir_path = Path::new(&out_dir).to_path_buf();
|
||||
|
|
|
@ -56,7 +56,7 @@ pub(crate) fn override_derive(filenames: &[(&str, &str)]) {
|
|||
|
||||
#![allow(clippy::derivable_impls)]
|
||||
|
||||
//! This module is automatically generated by config_macros.rs.
|
||||
//! This module is automatically generated by `config_macros.rs`.
|
||||
|
||||
use super::*;
|
||||
use melib::HeaderName;
|
||||
|
@ -192,7 +192,7 @@ use melib::HeaderName;
|
|||
#(#attrs_tokens)*
|
||||
impl Default for #override_ident {
|
||||
fn default() -> Self {
|
||||
#override_ident {
|
||||
Self {
|
||||
#(#field_idents: None),*
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,354 @@
|
|||
'\" t
|
||||
.\"<!-- Copyright 1998 - 2007 Double Precision, Inc. See COPYING for -->
|
||||
.\"<!-- distribution information. -->
|
||||
.\" Title: maildir
|
||||
.\" Author: Sam Varshavchik
|
||||
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
|
||||
.\" Date: 07/24/2017
|
||||
.\" Manual: Double Precision, Inc.
|
||||
.\" Source: Courier Mail Server
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "MAILDIR" "5" "07/24/2017" "Courier Mail Server" "Double Precision, Inc\&."
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * Define some portability stuff
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.\" http://bugs.debian.org/507673
|
||||
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * set default formatting
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" disable hyphenation
|
||||
.nh
|
||||
.\" disable justification (adjust text to left margin only)
|
||||
.ad l
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * MAIN CONTENT STARTS HERE *
|
||||
.\" -----------------------------------------------------------------
|
||||
.SH "NAME"
|
||||
maildir \- E\-mail directory
|
||||
.SH "SYNOPSIS"
|
||||
.sp
|
||||
$HOME/Maildir
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
A
|
||||
\(lqMaildir\(rq
|
||||
is a structured directory that holds E\-mail messages\&. Maildirs were first implemented by the
|
||||
Qmail
|
||||
mail server\&. Qmail\*(Aqs maildirs were a simple data structure, nothing more than a single collection of E\-mail messages\&. The
|
||||
Courier
|
||||
mail server builds upon
|
||||
Qmail\*(Aqs maildirs to provide extended functionality, such as folders and quotas\&. This document describes the
|
||||
Courier
|
||||
mail server\*(Aqs extended maildirs, without explicitly identifying The
|
||||
Courier
|
||||
mail server\-specific extensions\&. See
|
||||
\fBmaildir\fR(5)
|
||||
in Qmail\*(Aqs documentation for the original definition of maildirs\&.
|
||||
.PP
|
||||
Traditionally, E\-mail folders were saved as plain text files, called
|
||||
\(lqmboxes\(rq\&. Mboxes have known limitations\&. Only one application can use an mbox at the same time\&. Locking is required in order to allow simultaneous concurrent access by different applications\&. Locking is often problematic, and not very reliable in network\-based filesystem requirements\&. Some network\-based filesystems don\*(Aqt offer any reliable locking mechanism at all\&. Furthermore, even bulletproof locking won\*(Aqt prevent occasional mbox corruption\&. A process can be killed or terminated in the middle of updating an mbox\&. This will likely result in corruption, and a loss of most messages in the mbox\&.
|
||||
.PP
|
||||
Maildirs allow multiple concurrent access by different applications\&. Maildirs do not require locking\&. Multiple applications can update a maildir at the same time, without stepping on each other\*(Aqs feet\&.
|
||||
.SS "Maildir contents"
|
||||
.PP
|
||||
A
|
||||
\(lqmaildir\(rq
|
||||
is a directory that\*(Aqs created by
|
||||
\m[blue]\fB\fBmaildirmake\fR(1)\fR\m[]\&\s-2\u[1]\d\s+2\&. Naturally, maildirs should not have any group or world permissions, unless you want other people to read your mail\&. A maildir contains three subdirectories:
|
||||
tmp,
|
||||
new, and
|
||||
cur\&. These three subdirectories comprise the primary folder, where new mail is delivered by the system\&.
|
||||
.PP
|
||||
Folders are additional subdirectories in the maildir whose names begin with a period: such as
|
||||
\&.Drafts
|
||||
or
|
||||
\&.Sent\&. Each folder itself contains the same three subdirectories,
|
||||
tmp,
|
||||
new, and
|
||||
cur, and an additional zero\-length file named
|
||||
maildirfolder, whose purpose is to inform any mail delivery agent that it\*(Aqs really delivering to a folder, and that the mail delivery agent should look in the parent directory for any maildir\-related information\&.
|
||||
.PP
|
||||
Folders are not physically nested\&. A folder subdirectory, such as
|
||||
\&.Sent
|
||||
does not itself contain any subfolders\&. The main maildir contains a single, flat list of subfolders\&. These folders are logically nested, and periods serve to separate folder hierarchies\&. For example,
|
||||
\&.Sent\&.2002
|
||||
is considered to be a subfolder called
|
||||
\(lq2002\(rq
|
||||
which is a subfolder of
|
||||
\(lqSent\(rq\&.
|
||||
.sp
|
||||
.it 1 an-trap
|
||||
.nr an-no-space-flag 1
|
||||
.nr an-break-flag 1
|
||||
.br
|
||||
.ps +1
|
||||
\fBFolder name encoding\fR
|
||||
.RS 4
|
||||
.PP
|
||||
Folder names can contain any Unicode character, except for control characters\&. US\-ASCII characters, U+0x0020 \- U+0x007F, except for the period, forward\-slash, and ampersand characters (U+0x002E, U+0x002F, and U+0x0026) represent themselves\&. The ampersand is represent by the two character sequence
|
||||
\(lq&\-\(rq\&. The period, forward slash, and non US\-ASCII Unicode characters are represented using the UTF\-7 character set, and encoded with a modified form of base64\-encoding\&.
|
||||
.PP
|
||||
The
|
||||
\(lq&\(rq
|
||||
character starts the modified base64\-encoded sequence; the sequence is terminated by the
|
||||
\(lq\-\(rq
|
||||
character\&. The sequence of 16\-bit Unicode characters is written in big\-endian order, and encoded using the base64\-encoding method described in section 5\&.2 of
|
||||
\m[blue]\fBRFC 1521\fR\m[]\&\s-2\u[2]\d\s+2, with the following modifications:
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
.sp -1
|
||||
.IP \(bu 2.3
|
||||
.\}
|
||||
The
|
||||
\(lq=\(rq
|
||||
padding character is omitted\&. When decoding, an incomplete 16\-bit character is discarded\&.
|
||||
.RE
|
||||
.sp
|
||||
.RS 4
|
||||
.ie n \{\
|
||||
\h'-04'\(bu\h'+03'\c
|
||||
.\}
|
||||
.el \{\
|
||||
.sp -1
|
||||
.IP \(bu 2.3
|
||||
.\}
|
||||
The comma character,
|
||||
\(lq,\(rq
|
||||
is used in place of the
|
||||
\(lq/\(rq
|
||||
character in the base64 alphabet\&.
|
||||
.RE
|
||||
.PP
|
||||
For example, the word
|
||||
\(lqResume\(rq
|
||||
with both "e"s being the e\-acute character, U+0x00e9, is encoded as
|
||||
\(lqR&AOk\-sum&AOk\-\(rq
|
||||
(so a folder of that name would be a maildir subdirectory called
|
||||
\(lq\&.R&AOk\-sum&AOk\-\(rq)\&.
|
||||
.RE
|
||||
.sp
|
||||
.it 1 an-trap
|
||||
.nr an-no-space-flag 1
|
||||
.nr an-break-flag 1
|
||||
.br
|
||||
.ps +1
|
||||
\fBOther maildir contents\fR
|
||||
.RS 4
|
||||
.PP
|
||||
Software that uses maildirs may also create additional files besides the
|
||||
tmp,
|
||||
new, and
|
||||
cur
|
||||
subdirectories \-\- in the main maildir or a subfolder \-\- for its own purposes\&.
|
||||
.RE
|
||||
.SS "Messages"
|
||||
.PP
|
||||
E\-mail messages are stored in separate, individual files, one E\-mail message per file\&. The
|
||||
tmp
|
||||
subdirectory temporarily stores E\-mail messages that are in the process of being delivered to this maildir\&.
|
||||
tmp
|
||||
may also store other kinds of temporary files, as long as they are created in the same way that message files are created in
|
||||
tmp\&. The
|
||||
new
|
||||
subdirectory stores messages that have been delivered to this maildir, but have not yet been seen by any mail application\&. The
|
||||
cur
|
||||
subdirectory stores messages that have already been seen by mail applications\&.
|
||||
.SS "Adding new mail to maildirs"
|
||||
.PP
|
||||
The following process delivers a new message to the maildir:
|
||||
.PP
|
||||
A new unique filename is created using one of two possible forms:
|
||||
\(lqtime\&.MusecPpid\&.host\(rq, or
|
||||
\(lqtime\&.MusecPpid_unique\&.host\(rq\&.
|
||||
\(lqtime\(rq
|
||||
and
|
||||
\(lqusec\(rq
|
||||
is the current system time, obtained from
|
||||
\fBgettimeofday\fR(2)\&.
|
||||
\(lqpid\(rq
|
||||
is the process number of the process that is delivering this message to the maildir\&.
|
||||
\(lqhost\(rq
|
||||
is the name of the machine where the mail is being delivered\&. In the event that the same process creates multiple messages, a suffix unique to each message is appended to the process id; preferrably an underscore, followed by an increasing counter\&. This applies whether messages created by a process are all added to the same, or different, maildirs\&. This protocol allows multiple processes running on multiple machines on the same network to simultaneously create new messages without stomping on each other\&.
|
||||
.PP
|
||||
The filename created in the previous step is checked for existence by executing the
|
||||
\fBstat\fR(2)
|
||||
system call\&. If
|
||||
\fBstat\fR(2)
|
||||
results in ANYTHING OTHER than the system error
|
||||
ENOENT, the process must sleep for two seconds, then go back and create another unique filename\&. This is an extra step to insure that each new message has a completely unique filename\&.
|
||||
.PP
|
||||
Other applications that wish to use
|
||||
tmp
|
||||
for temporary storage should observe the same protocol (but see READING MAIL FROM MAILDIRS below, because old files in
|
||||
tmp
|
||||
will be eventually deleted)\&.
|
||||
.PP
|
||||
If the
|
||||
\fBstat\fR(2)
|
||||
system call returned
|
||||
ENOENT, the process may proceed to create the file in the
|
||||
tmp
|
||||
subdirectory, and save the entire message in the new file\&. The message saved MUST NOT have the
|
||||
\(lqFrom_\(rq
|
||||
header that is used to mboxes\&. The message also MUST NOT have any
|
||||
\(lqFrom_\(rq
|
||||
lines in the contents of the message prefixed by the
|
||||
\(lq>\(rq
|
||||
character\&.
|
||||
.PP
|
||||
When saving the message, the number of bytes returned by the
|
||||
\fBwrite\fR(2)
|
||||
system call must be checked, in order to make sure that the complete message has been written out\&.
|
||||
.PP
|
||||
After the message is saved, the file descriptor is
|
||||
\fBfstat\fR(2)\-ed\&. The file\*(Aqs device number, inode number, and the its byte size, are saved\&. The file is closed and is then immediately moved/renamed into the
|
||||
new
|
||||
subdirectory\&. The name of the file in
|
||||
new
|
||||
should be
|
||||
\(lqtime\&.MusecPpidVdevIino\&.host,S=\fIcnt\fR\(rq, or
|
||||
\(lqtime\&.MusecPpidVdevIino_unique\&.host,S=\fIcnt\fR\(rq\&.
|
||||
\(lqdev\(rq
|
||||
is the message\*(Aqs device number,
|
||||
\(lqino\(rq
|
||||
is the message\*(Aqs inode number (from the previous
|
||||
\fBfstat\fR(2)
|
||||
call); and
|
||||
\(lqcnt\(rq
|
||||
is the message\*(Aqs size, in bytes\&.
|
||||
.PP
|
||||
The
|
||||
\(lq,S=\fIcnt\fR\(rq
|
||||
part optimizes the
|
||||
\m[blue]\fBCourier\fR\m[]\&\s-2\u[3]\d\s+2
|
||||
mail server\*(Aqs maildir quota enhancement; it allows the size of all the mail stored in the maildir to be added up without issuing the
|
||||
\fBstat\fR(2)
|
||||
system call for each individual message (this can be quite a performance drain with certain network filesystems)\&.
|
||||
.SS "READING MAIL FROM MAILDIRS"
|
||||
.PP
|
||||
Applications that read mail from maildirs should do it in the following order:
|
||||
.PP
|
||||
When opening a maildir or a maildir folder, read the
|
||||
tmp
|
||||
subdirectory and delete any files in there that are at least 36 hours old\&.
|
||||
.PP
|
||||
Look for new messages in the
|
||||
new
|
||||
subdirectory\&. Rename
|
||||
\fInew/filename\fR, as
|
||||
\fIcur/filename:2,info\fR\&. Here,
|
||||
\fIinfo\fR
|
||||
represents the state of the message, and it consists of zero or more boolean flags chosen from the following:
|
||||
\(lqD\(rq
|
||||
\- this is a \*(Aqdraft\*(Aq message,
|
||||
\(lqR\(rq
|
||||
\- this message has been replied to,
|
||||
\(lqS\(rq
|
||||
\- this message has been viewed (seen),
|
||||
\(lqT\(rq
|
||||
\- this message has been marked to be deleted (trashed), but is not yet removed (messages are removed from maildirs simply by deleting their file),
|
||||
\(lqF\(rq
|
||||
\- this message has been marked by the user, for some purpose\&. These flags must be stored in alphabetical order\&. New messages contain only the
|
||||
:2,
|
||||
suffix, with no flags, indicating that the messages were not seen, replied, marked, or deleted\&.
|
||||
.PP
|
||||
Maildirs may have maximum size quotas defined, but these quotas are purely voluntary\&. If you need to implement mandatory quotas, you should use any quota facilities provided by the underlying filesystem that is used to store the maildirs\&. The maildir quota enhancement is designed to be used in certain situations where filesystem\-based quotas cannot be used for some reason\&. The implementation is designed to avoid the use of any locking\&. As such, at certain times the calculated quota may be imprecise, and certain anomalous situations may result in the maildir actually going over the stated quota\&. One such situation would be when applications create messages without updating the quota estimate for the maildir\&. Eventually it will be precisely recalculated, but wherever possible new messages should be created in compliance with the voluntary quota protocol\&.
|
||||
.PP
|
||||
The voluntary quota protocol involves some additional procedures that must be followed when creating or deleting messages within a given maildir or its subfolders\&. The
|
||||
\m[blue]\fB\fBdeliverquota\fR(8)\fR\m[]\&\s-2\u[4]\d\s+2
|
||||
command is a tiny application that delivers a single message to a maildir using the voluntary quota protocol, and hopefully it can be used as a measure of last resort\&. Alternatively, applications can use the
|
||||
libmaildir\&.a
|
||||
library to handle all the low\-level dirty details for them\&. The voluntary quota enhancement is described in the
|
||||
\m[blue]\fB\fBmaildirquota\fR(7)\fR\m[]\&\s-2\u[5]\d\s+2
|
||||
man page\&.
|
||||
.SS "Maildir Quotas"
|
||||
.PP
|
||||
This is a voluntary mechanism for enforcing "loose" quotas on the maximum sizes of maildirs\&. This mechanism is enforced in software, and not by the operating system\&. Therefore it is only effective as long as the maildirs themselves are not directly accessible by their users, since this mechanism is trivially disabled\&.
|
||||
.PP
|
||||
If possible, operating system\-enforced quotas are preferrable\&. Where operating system quota enforcement is not available, or not possible, this voluntary quota enforcement mechanism might be an acceptable compromise\&. Since it\*(Aqs enforced in software, all software that modifies or accesses the maildirs is required to voluntary obey and enforce a quota\&. The voluntary quota implementation is flexible enough to allow non quota\-aware applications to also access the maildirs, without any drastic consequences\&. There will be some non\-drastic consequences, though\&. Of course, non quota\-aware applications will not enforce any defined quotas\&. Furthermore, this voluntary maildir quota mechanism works by estimating the current size of the maildir, with periodic exact recalculation\&. Obviously non quota\-aware maildir applications will not update the maildir size estimation, so the estimate will be thrown off for some period of time, until the next recalculation\&.
|
||||
.PP
|
||||
This voluntary quota mechanism is designed to be a reasonable compromise between effectiveness, and performance\&. The entire purpose of using maildir\-based mail storage is to avoid any kind of locking, and to permit parallel access to mail by multiple applications\&. In order to compute the exact size of a maildir, the maildir must be locked somehow to prevent any modifications while its contents are added up\&. Obviously something like that defeats the original purpose of using maildirs, therefore the voluntary quota mechanism does not use locking, and that\*(Aqs why the current recorded maildir size is always considered to be an estimate\&. Regular size recalculations will compensate for any occasional race conditions that result in the estimate to be thrown off\&.
|
||||
.PP
|
||||
A quota for an existing maildir is installed by running maildirmake with the
|
||||
\-q
|
||||
option, and naming an existing maildir\&. The
|
||||
\-q
|
||||
option takes a parameter,
|
||||
\fIquota\fR, which is a comma\-separated list of quota specifications\&. A quota specification consists of a number followed by either \*(AqS\*(Aq, indicating the maximum message size in bytes, or \*(AqC\*(Aq, maximum number of messages\&. For example:
|
||||
.sp
|
||||
.if n \{\
|
||||
.RS 4
|
||||
.\}
|
||||
.nf
|
||||
\fBmaildirmake \-q 5000000S,1000C \&./Maildir\fR
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.\}
|
||||
.PP
|
||||
This sets the quota to 5,000,000 bytes or 1000 messages, whichever comes first\&.
|
||||
.sp
|
||||
.if n \{\
|
||||
.RS 4
|
||||
.\}
|
||||
.nf
|
||||
\fBmaildirmake \-q 1000000S \&./Maildir\fR
|
||||
.fi
|
||||
.if n \{\
|
||||
.RE
|
||||
.\}
|
||||
.PP
|
||||
This sets the quota to 1,000,000 bytes, without limiting the number of messages\&.
|
||||
.PP
|
||||
A quota of an existing maildir can be changed by rerunning the
|
||||
\fBmaildirmake\fR
|
||||
command with a new
|
||||
\-q
|
||||
option\&. To delete a quota entirely, delete the
|
||||
\fIMaildir\fR/maildirsize
|
||||
file\&.
|
||||
.SH "SEE ALSO"
|
||||
.PP
|
||||
\m[blue]\fB\fBmaildirmake\fR(1)\fR\m[]\&\s-2\u[1]\d\s+2\&.
|
||||
.SH "AUTHOR"
|
||||
.PP
|
||||
\fBSam Varshavchik\fR
|
||||
.RS 4
|
||||
Author
|
||||
.RE
|
||||
.SH "NOTES"
|
||||
.IP " 1." 4
|
||||
\fBmaildirmake\fR(1)
|
||||
.RS 4
|
||||
\%http://www.courier-mta.org/maildirmake.html
|
||||
.RE
|
||||
.IP " 2." 4
|
||||
RFC 1521
|
||||
.RS 4
|
||||
\%http://www.rfc-editor.org/rfc/rfc1521.txt
|
||||
.RE
|
||||
.IP " 3." 4
|
||||
Courier
|
||||
.RS 4
|
||||
\%http://www.courier-mta.org
|
||||
.RE
|
||||
.IP " 4." 4
|
||||
\fBdeliverquota\fR(8)
|
||||
.RS 4
|
||||
\%http://www.courier-mta.org/deliverquota.html
|
||||
.RE
|
||||
.IP " 5." 4
|
||||
\fBmaildirquota\fR(7)
|
||||
.RS 4
|
||||
\%http://www.courier-mta.org/maildirquota.html
|
||||
.RE
|
|
@ -0,0 +1,187 @@
|
|||
'\" t
|
||||
.\" -*-nroff-*-
|
||||
.\"
|
||||
.\" Copyright (C) 2000 Thomas Roessler <roessler@does-not-exist.org>
|
||||
.\"
|
||||
.\" This document is in the public domain and may be distributed and
|
||||
.\" changed arbitrarily.
|
||||
.\"
|
||||
.TH mbox 5 "February 19th, 2002" Unix "User Manuals"
|
||||
.\"
|
||||
.SH NAME
|
||||
mbox \- Format for mail message storage.
|
||||
.\"
|
||||
.SH DESCRIPTION
|
||||
This document describes the format traditionally used by Unix hosts
|
||||
to store mail messages locally.
|
||||
.B mbox
|
||||
files typically reside in the system's mail spool, under various
|
||||
names in users' Mail directories, and under the name
|
||||
.B mbox
|
||||
in users' home directories.
|
||||
.PP
|
||||
An
|
||||
.B mbox
|
||||
is a text file containing an arbitrary number of e-mail messages.
|
||||
Each message consists of a postmark, followed by an e-mail message
|
||||
formatted according to \fBRFC822\fP, \fBRFC2822\fP. The file format
|
||||
is line-oriented. Lines are separated by line feed characters (ASCII 10).
|
||||
.PP
|
||||
A postmark line consists of the four characters "From", followed by
|
||||
a space character, followed by the message's envelope sender
|
||||
address, followed by whitespace, and followed by a time stamp. This
|
||||
line is often called From_ line.
|
||||
.PP
|
||||
The sender address is expected to be
|
||||
.B addr-spec
|
||||
as defined in \fBRFC2822\fP 3.4.1. The date is expected to be
|
||||
.B date-time
|
||||
as output by
|
||||
.BR asctime (3).
|
||||
For compatibility reasons with legacy software, two-digit years
|
||||
greater than or equal to 70 should be interpreted as the years
|
||||
1970+, while two-digit years less than 70 should be interpreted as
|
||||
the years 2000-2069. Software reading files in this format should
|
||||
also be prepared to accept non-numeric timezone information such as
|
||||
"CET DST" for Central European Time, daylight saving time.
|
||||
.PP
|
||||
Example:
|
||||
.IP "" 1
|
||||
>From example@example.com Fri Jun 23 02:56:55 2000
|
||||
.PP
|
||||
In order to avoid misinterpretation of lines in message bodies
|
||||
which begin with the four characters "From", followed by a space
|
||||
character, the mail delivery agent must quote any occurrence
|
||||
of "From " at the start of a body line.
|
||||
.sp
|
||||
There are two different quoting schemes, the first (\fBMBOXO\fP) only
|
||||
quotes plain "From " lines in the body by prepending a '>' to the
|
||||
line; the second (\fBMBOXRD\fP) also quotes already quoted "From "
|
||||
lines by prepending a '>' (i.e. ">From ", ">>From ", ...). The later
|
||||
has the advantage that lines like
|
||||
.IP "" 1
|
||||
>From the command line you can use the '\-p' option
|
||||
.PP
|
||||
aren't dequoted wrongly as a \fBMBOXRD\fP-MDA would turn the line
|
||||
into
|
||||
.IP "" 1
|
||||
>>From the command line you can use the '\-p' option
|
||||
.PP
|
||||
before storing it. Besides \fBMBOXO\fP and \fBMBOXRD\fP there is also
|
||||
\fBMBOXCL\fP which is \fBMBOXO\fP with a "Content-Length:"\-field with the
|
||||
number of bytes in the message body; some MUAs (like
|
||||
.BR mutt (1))
|
||||
do automatically transform \fBMBOXO\fP mailboxes into \fBMBOXCL\fP ones when
|
||||
ever they write them back as \fBMBOXCL\fP can be read by any \fBMBOXO\fP-MUA
|
||||
without any problems.
|
||||
.PP
|
||||
If the modification-time (usually determined via
|
||||
.BR stat (2))
|
||||
of a nonempty
|
||||
.B mbox
|
||||
file is greater than the access-time the file has new mail. Many MUAs
|
||||
place a Status: header in each message to indicate which messages have
|
||||
already been read.
|
||||
.\"
|
||||
.SH LOCKING
|
||||
Since
|
||||
.B mbox
|
||||
files are frequently accessed by multiple programs in parallel,
|
||||
.B mbox
|
||||
files should generally not be accessed without locking.
|
||||
.PP
|
||||
Three different locking mechanisms (and combinations thereof) are in
|
||||
general use:
|
||||
.IP "\(bu"
|
||||
.BR fcntl (2)
|
||||
locking is mostly used on recent, POSIX-compliant systems. Use of
|
||||
this locking method is, in particular, advisable if
|
||||
.B mbox
|
||||
files are accessed through the Network File System (NFS), since it
|
||||
seems the only way to reliably invalidate NFS clients' caches.
|
||||
.IP "\(bu"
|
||||
.BR flock (2)
|
||||
locking is mostly used on BSD-based systems.
|
||||
.IP "\(bu"
|
||||
Dotlocking is used on all kinds of systems. In order to lock an
|
||||
.B mbox
|
||||
file named \fIfolder\fR, an application first creates a temporary file
|
||||
with a unique name in the directory in which the
|
||||
\fIfolder\fR resides. The application then tries to use the
|
||||
.BR link (2)
|
||||
system call to create a hard link named \fIfolder.lock\fR
|
||||
to the temporary file. The success of the
|
||||
.BR link (2)
|
||||
system call should be additionally verified using
|
||||
.BR stat (2)
|
||||
calls. If the link has succeeded, the mail folder is considered
|
||||
dotlocked. The temporary file can then safely be unlinked.
|
||||
.IP ""
|
||||
In order to release the lock, an application just unlinks the
|
||||
\fIfolder.lock\fR file.
|
||||
.PP
|
||||
If multiple methods are combined, implementors should make sure to
|
||||
use the non-blocking variants of the
|
||||
.BR fcntl (2)
|
||||
and
|
||||
.BR flock (2)
|
||||
system calls in order to avoid deadlocks.
|
||||
.PP
|
||||
If multiple methods are combined, an
|
||||
.B mbox
|
||||
file must not be considered to have been successfully locked before
|
||||
all individual locks were obtained. When one of the individual
|
||||
locking methods fails, an application should release all locks it
|
||||
acquired successfully, and restart the entire locking procedure from
|
||||
the beginning, after a suitable delay.
|
||||
.PP
|
||||
The locking mechanism used on a particular system is a matter of
|
||||
local policy, and should be consistently used by all applications
|
||||
installed on the system which access
|
||||
.B mbox
|
||||
files. Failure to do so may result in loss of e-mail data, and in
|
||||
corrupted
|
||||
.B mbox
|
||||
files.
|
||||
.\"
|
||||
.SH FILES
|
||||
.IR /var/spool/mail/$LOGNAME
|
||||
.RS
|
||||
\fB$LOGNAME\fP's incoming mail folder.
|
||||
.RE
|
||||
.PP
|
||||
.IR $HOME/mbox
|
||||
.RS
|
||||
user's archived mail messages, in his \fB$HOME\fP directory.
|
||||
.RE
|
||||
.PP
|
||||
.IR $HOME/Mail/
|
||||
.RS
|
||||
A directory in user's \fB$HOME\fP directory which is commonly used to hold
|
||||
.B mbox
|
||||
format folders.
|
||||
.RE
|
||||
.PP
|
||||
.\"
|
||||
.SH "SEE ALSO"
|
||||
.BR mutt (1),
|
||||
.BR fcntl (2),
|
||||
.BR flock (2),
|
||||
.BR link (2),
|
||||
.BR stat (2),
|
||||
.BR asctime (3),
|
||||
.BR maildir (5),
|
||||
.BR mmdf (5),
|
||||
.BR RFC822 ,
|
||||
.BR RFC976 ,
|
||||
.BR RFC2822
|
||||
.\"
|
||||
.SH AUTHOR
|
||||
Thomas Roessler <roessler@does-not-exist.org>, Urs Janssen <urs@tin.org>
|
||||
.\"
|
||||
.SH HISTORY
|
||||
The
|
||||
.B mbox
|
||||
format occurred in Version 6 AT&T Unix.
|
||||
.br
|
||||
A variant of this format was documented in \fBRFC976\fP.
|
|
@ -0,0 +1,235 @@
|
|||
.TH mbox 5
|
||||
.SH "NAME"
|
||||
mbox \- file containing mail messages
|
||||
.SH "INTRODUCTION"
|
||||
The most common format for storage of mail messages is
|
||||
.I mbox
|
||||
format.
|
||||
An
|
||||
.I mbox
|
||||
is a single file containing zero or more mail messages.
|
||||
.SH "MESSAGE FORMAT"
|
||||
A message encoded in
|
||||
.I mbox
|
||||
format begins with a
|
||||
.B From_
|
||||
line, continues with a series of
|
||||
.B \fRnon-\fBFrom_
|
||||
lines,
|
||||
and ends with a blank line.
|
||||
A
|
||||
.B From_
|
||||
line means any line that begins with the characters
|
||||
F, r, o, m, space:
|
||||
|
||||
.EX
|
||||
From god@heaven.af.mil Sat Jan 3 01:05:34 1996
|
||||
.br
|
||||
Return-Path: <god@heaven.af.mil>
|
||||
.br
|
||||
Delivered-To: djb@silverton.berkeley.edu
|
||||
.br
|
||||
Date: 3 Jan 1996 01:05:34 -0000
|
||||
.br
|
||||
From: God <god@heaven.af.mil>
|
||||
.br
|
||||
To: djb@silverton.berkeley.edu (D. J. Bernstein)
|
||||
.br
|
||||
|
||||
.br
|
||||
How's that mail system project coming along?
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
||||
The final line is a completely blank line (no spaces or tabs).
|
||||
Notice that blank lines may also appear elsewhere in the message.
|
||||
|
||||
The
|
||||
.B From_
|
||||
line always looks like
|
||||
.B From
|
||||
.I envsender
|
||||
.I date
|
||||
.IR moreinfo .
|
||||
.I envsender
|
||||
is one word, without spaces or tabs;
|
||||
it is usually the envelope sender of the message.
|
||||
.I date
|
||||
is the delivery date of the message.
|
||||
It always contains exactly 24 characters in
|
||||
.B asctime
|
||||
format.
|
||||
.I moreinfo
|
||||
is optional; it may contain arbitrary information.
|
||||
|
||||
Between the
|
||||
.B From_
|
||||
line and the blank line is a message in RFC 822 format,
|
||||
as described in
|
||||
.BR qmail-header(5) ,
|
||||
subject to
|
||||
.B >From quoting
|
||||
as described below.
|
||||
.SH "HOW A MESSAGE IS DELIVERED"
|
||||
Here is how a program appends a message to an
|
||||
.I mbox
|
||||
file.
|
||||
|
||||
It first creates a
|
||||
.B From_
|
||||
line given the message's envelope sender and the current date.
|
||||
If the envelope sender is empty (i.e., if this is a bounce message),
|
||||
the program uses
|
||||
.B MAILER-DAEMON
|
||||
instead.
|
||||
If the envelope sender contains spaces, tabs, or newlines,
|
||||
the program replaces them with hyphens.
|
||||
|
||||
The program then copies the message, applying
|
||||
.B >From quoting
|
||||
to each line.
|
||||
.B >From quoting
|
||||
ensures that the resulting lines are not
|
||||
.B From_
|
||||
lines:
|
||||
the program prepends a
|
||||
.B >
|
||||
to any
|
||||
.B From_
|
||||
line,
|
||||
.B >From_
|
||||
line,
|
||||
.B >>From_
|
||||
line,
|
||||
.B >>>From_
|
||||
line,
|
||||
etc.
|
||||
|
||||
Finally the program appends a blank line to the message.
|
||||
If the last line of the message was a partial line,
|
||||
it writes two newlines;
|
||||
otherwise it writes one.
|
||||
.SH "HOW A MESSAGE IS READ"
|
||||
A reader scans through an
|
||||
.I mbox
|
||||
file looking for
|
||||
.B From_
|
||||
lines.
|
||||
Any
|
||||
.B From_
|
||||
line marks the beginning of a message.
|
||||
The reader should not attempt to take advantage of the fact that every
|
||||
.B From_
|
||||
line (past the beginning of the file)
|
||||
is preceded by a blank line.
|
||||
|
||||
Once the reader finds a message,
|
||||
it extracts a (possibly corrupted) envelope sender
|
||||
and delivery date out of the
|
||||
.B From_
|
||||
line.
|
||||
It then reads until the next
|
||||
.B From_
|
||||
line or end of file, whichever comes first.
|
||||
It strips off the final blank line
|
||||
and
|
||||
deletes the
|
||||
quoting of
|
||||
.B >From_
|
||||
lines and
|
||||
.B >>From_
|
||||
lines and so on.
|
||||
The result is an RFC 822 message.
|
||||
.SH "COMMON MBOX VARIANTS"
|
||||
There are many variants of
|
||||
.I mbox
|
||||
format.
|
||||
The variant described above is
|
||||
.I mboxrd
|
||||
format, popularized by Rahul Dhesi in June 1995.
|
||||
|
||||
The original
|
||||
.I mboxo
|
||||
format quotes only
|
||||
.B From_
|
||||
lines, not
|
||||
.B >From_
|
||||
lines.
|
||||
As a result it is impossible to tell whether
|
||||
|
||||
.EX
|
||||
From: djb@silverton.berkeley.edu (D. J. Bernstein)
|
||||
.br
|
||||
To: god@heaven.af.mil
|
||||
.br
|
||||
|
||||
.br
|
||||
>From now through August I'll be doing beta testing.
|
||||
.br
|
||||
Thanks for your interest.
|
||||
.EE
|
||||
|
||||
was quoted in the original message.
|
||||
An
|
||||
.I mboxrd
|
||||
reader will always strip off the quoting.
|
||||
|
||||
.I mboxcl
|
||||
format is like
|
||||
.I mboxo
|
||||
format, but includes a Content-Length field with the
|
||||
number of bytes in the message.
|
||||
.I mboxcl2
|
||||
format is like
|
||||
.I mboxcl
|
||||
but has no
|
||||
.B >From
|
||||
quoting.
|
||||
These formats are used by SVR4 mailers.
|
||||
.I mboxcl2
|
||||
cannot be read safely by
|
||||
.I mboxrd
|
||||
readers.
|
||||
.SH "UNSPECIFIED DETAILS"
|
||||
There are many locking mechanisms for
|
||||
.I mbox
|
||||
files.
|
||||
.B qmail-local
|
||||
always uses
|
||||
.B flock
|
||||
on systems that have it, otherwise
|
||||
.BR lockf .
|
||||
|
||||
The delivery date in a
|
||||
.B From_
|
||||
line does not specify a time zone.
|
||||
.B qmail-local
|
||||
always creates the delivery date in GMT
|
||||
so that
|
||||
.I mbox
|
||||
files can be safely transported from one time zone to another.
|
||||
|
||||
If the mtime on a nonempty
|
||||
.I mbox
|
||||
file is greater than the atime,
|
||||
the file has new mail.
|
||||
If the mtime is smaller than the atime,
|
||||
the new mail has been read.
|
||||
If the atime equals the mtime,
|
||||
there is no way to tell whether the file has new mail,
|
||||
since
|
||||
.B qmail-local
|
||||
takes much less than a second to run.
|
||||
One solution is for a mail reader to artificially set the
|
||||
atime to the mtime plus 1.
|
||||
Then the file has new mail if and only if the atime is
|
||||
less than or equal to the mtime.
|
||||
|
||||
Some mail readers place
|
||||
.B Status
|
||||
fields in each message to indicate which messages have been read.
|
||||
.SH "SEE ALSO"
|
||||
maildir(5),
|
||||
qmail-header(5),
|
||||
qmail-local(8)
|
|
@ -0,0 +1,239 @@
|
|||
.TH maildir 5
|
||||
.SH "NAME"
|
||||
maildir \- directory for incoming mail messages
|
||||
.SH "INTRODUCTION"
|
||||
.I maildir
|
||||
is a structure for
|
||||
directories of incoming mail messages.
|
||||
It solves the reliability problems that plague
|
||||
.I mbox
|
||||
files and
|
||||
.I mh
|
||||
folders.
|
||||
.SH "RELIABILITY ISSUES"
|
||||
A machine may crash while it is delivering a message.
|
||||
For both
|
||||
.I mbox
|
||||
files and
|
||||
.I mh
|
||||
folders this means that the message will be silently truncated.
|
||||
Even worse: for
|
||||
.I mbox
|
||||
format, if the message is truncated in the middle of a line,
|
||||
it will be silently joined to the next message.
|
||||
The mail transport agent will try again later to deliver the message,
|
||||
but it is unacceptable that a corrupted message should show up at all.
|
||||
In
|
||||
.IR maildir ,
|
||||
every message is guaranteed complete upon delivery.
|
||||
|
||||
A machine may have two programs simultaneously delivering mail
|
||||
to the same user.
|
||||
The
|
||||
.I mbox
|
||||
and
|
||||
.I mh
|
||||
formats require the programs to update a single central file.
|
||||
If the programs do not use some locking mechanism,
|
||||
the central file will be corrupted.
|
||||
There are several
|
||||
.I mbox
|
||||
and
|
||||
.I mh
|
||||
locking mechanisms,
|
||||
none of which work portably and reliably.
|
||||
In contrast, in
|
||||
.IR maildir ,
|
||||
no locks are ever necessary.
|
||||
Different delivery processes never touch the same file.
|
||||
|
||||
A user may try to delete messages from his mailbox at the same
|
||||
moment that the machine delivers a new message.
|
||||
For
|
||||
.I mbox
|
||||
and
|
||||
.I mh
|
||||
formats, the user's mail-reading program must know
|
||||
what locking mechanism the mail-delivery programs use.
|
||||
In contrast, in
|
||||
.IR maildir ,
|
||||
any delivered message
|
||||
can be safely updated or deleted by a mail-reading program.
|
||||
|
||||
Many sites use Sun's
|
||||
.B Network F\fPa\fBil\fPur\fBe System
|
||||
(NFS),
|
||||
presumably because the operating system vendor does not offer
|
||||
anything else.
|
||||
NFS exacerbates all of the above problems.
|
||||
Some NFS implementations don't provide
|
||||
.B any
|
||||
reliable locking mechanism.
|
||||
With
|
||||
.I mbox
|
||||
and
|
||||
.I mh
|
||||
formats,
|
||||
if two machines deliver mail to the same user,
|
||||
or if a user reads mail anywhere except the delivery machine,
|
||||
the user's mail is at risk.
|
||||
.I maildir
|
||||
works without trouble over NFS.
|
||||
.SH "THE MAILDIR STRUCTURE"
|
||||
A directory in
|
||||
.I maildir
|
||||
format has three subdirectories,
|
||||
all on the same filesystem:
|
||||
.BR tmp ,
|
||||
.BR new ,
|
||||
and
|
||||
.BR cur .
|
||||
|
||||
Each file in
|
||||
.B new
|
||||
is a newly delivered mail message.
|
||||
The modification time of the file is the delivery date of the message.
|
||||
The message is delivered
|
||||
.I without
|
||||
an extra UUCP-style
|
||||
.B From_
|
||||
line,
|
||||
.I without
|
||||
any
|
||||
.B >From
|
||||
quoting,
|
||||
and
|
||||
.I without
|
||||
an extra blank line at the end.
|
||||
The message is normally in RFC 822 format,
|
||||
starting with a
|
||||
.B Return-Path
|
||||
line and a
|
||||
.B Delivered-To
|
||||
line,
|
||||
but it could contain arbitrary binary data.
|
||||
It might not even end with a newline.
|
||||
|
||||
Files in
|
||||
.B cur
|
||||
are just like files in
|
||||
.BR new .
|
||||
The big difference is that files in
|
||||
.B cur
|
||||
are no longer new mail:
|
||||
they have been seen by the user's mail-reading program.
|
||||
.SH "HOW A MESSAGE IS DELIVERED"
|
||||
The
|
||||
.B tmp
|
||||
directory is used to ensure reliable delivery,
|
||||
as discussed here.
|
||||
|
||||
A program delivers a mail message in six steps.
|
||||
First, it
|
||||
.B chdir()\fPs
|
||||
to the
|
||||
.I maildir
|
||||
directory.
|
||||
Second, it
|
||||
.B stat()s
|
||||
the name
|
||||
.BR tmp/\fItime.pid.host ,
|
||||
where
|
||||
.I time
|
||||
is the number of seconds since the beginning of 1970 GMT,
|
||||
.I pid
|
||||
is the program's process ID,
|
||||
and
|
||||
.I host
|
||||
is the host name.
|
||||
Third, if
|
||||
.B stat()
|
||||
returned anything other than ENOENT,
|
||||
the program sleeps for two seconds, updates
|
||||
.IR time ,
|
||||
and tries the
|
||||
.B stat()
|
||||
again, a limited number of times.
|
||||
Fourth, the program
|
||||
creates
|
||||
.BR tmp/\fItime.pid.host .
|
||||
Fifth, the program
|
||||
.I NFS-writes
|
||||
the message to the file.
|
||||
Sixth, the program
|
||||
.BR link() s
|
||||
the file to
|
||||
.BR new/\fItime.pid.host .
|
||||
At that instant the message has been successfully delivered.
|
||||
|
||||
The delivery program is required to start a 24-hour timer before
|
||||
creating
|
||||
.BR tmp/\fItime.pid.host ,
|
||||
and to abort the delivery
|
||||
if the timer expires.
|
||||
Upon error, timeout, or normal completion,
|
||||
the delivery program may attempt to
|
||||
.B unlink()
|
||||
.BR tmp/\fItime.pid.host .
|
||||
|
||||
.I NFS-writing
|
||||
means
|
||||
(1) as usual, checking the number of bytes returned from each
|
||||
.B write()
|
||||
call;
|
||||
(2) calling
|
||||
.B fsync()
|
||||
and checking its return value;
|
||||
(3) calling
|
||||
.B close()
|
||||
and checking its return value.
|
||||
(Standard NFS implementations handle
|
||||
.B fsync()
|
||||
incorrectly
|
||||
but make up for it by abusing
|
||||
.BR close() .)
|
||||
.SH "HOW A MESSAGE IS READ"
|
||||
A mail reader operates as follows.
|
||||
|
||||
It looks through the
|
||||
.B new
|
||||
directory for new messages.
|
||||
Say there is a new message,
|
||||
.BR new/\fIunique .
|
||||
The reader may freely display the contents of
|
||||
.BR new/\fIunique ,
|
||||
delete
|
||||
.BR new/\fIunique ,
|
||||
or rename
|
||||
.B new/\fIunique
|
||||
as
|
||||
.BR cur/\fIunique:info .
|
||||
See
|
||||
.B http://pobox.com/~djb/proto/maildir.html
|
||||
for the meaning of
|
||||
.IR info .
|
||||
|
||||
The reader is also expected to look through the
|
||||
.B tmp
|
||||
directory and to clean up any old files found there.
|
||||
A file in
|
||||
.B tmp
|
||||
may be safely removed if it
|
||||
has not been accessed in 36 hours.
|
||||
|
||||
It is a good idea for readers to skip all filenames in
|
||||
.B new
|
||||
and
|
||||
.B cur
|
||||
starting with a dot.
|
||||
Other than this, readers should not attempt to parse filenames.
|
||||
.SH "ENVIRONMENT VARIABLES"
|
||||
Mail readers supporting
|
||||
.I maildir
|
||||
use the
|
||||
.B MAILDIR
|
||||
environment variable
|
||||
as the name of the user's primary mail directory.
|
||||
.SH "SEE ALSO"
|
||||
mbox(5),
|
||||
qmail-local(8)
|
|
@ -17,7 +17,8 @@
|
|||
.\" You should have received a copy of the GNU General Public License
|
||||
.\" along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.Dd November 11, 2022
|
||||
.\".Dd November 11, 2022
|
||||
.Dd March 10, 2024
|
||||
.Dt MELI-THEMES 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -31,15 +32,15 @@ comes with two themes,
|
|||
.Ic dark
|
||||
(default) and
|
||||
.Ic light .
|
||||
.sp
|
||||
.Pp
|
||||
Custom themes are defined as lists of key-values in the configuration files:
|
||||
.Bl -bullet -compact
|
||||
.Bl -item -compact -offset 2
|
||||
.It
|
||||
.Pa $XDG_CONFIG_HOME/meli/config.toml
|
||||
.It
|
||||
.Pa $XDG_CONFIG_HOME/meli/themes/*.toml
|
||||
.El
|
||||
.sp
|
||||
.Pp
|
||||
The application theme is defined in the configuration as follows:
|
||||
.Bd -literal
|
||||
[terminal]
|
||||
|
@ -56,9 +57,9 @@ keys are settings for the
|
|||
.Ic compact
|
||||
mail listing style.
|
||||
A setting contains three fields: fg for foreground color, bg for background color, and attrs for text attribute.
|
||||
.sp
|
||||
.Pp
|
||||
.Dl \&"widget.key.label\&" = { fg = \&"Default\&", bg = \&"Default\&", attrs = \&"Default\&" }
|
||||
.sp
|
||||
.Pp
|
||||
Each field contains a value, which may be either a color/attribute, a link (key name) or a valid alias.
|
||||
An alias is a string starting with the \&"\&$\&" character and must be declared in advance in the
|
||||
.Ic color_aliases
|
||||
|
@ -69,10 +70,14 @@ An alias' value can be any valid value, including links and other aliases, as lo
|
|||
In the case of a link the setting's real value depends on the value of the referred key.
|
||||
This allows for defaults within a group of associated values.
|
||||
Cyclic references in a theme results in an error:
|
||||
.sp
|
||||
.Pp
|
||||
.Dl spooky theme contains a cycle: fg: mail.listing.compact.even -> mail.listing.compact.highlighted -> mail.listing.compact.odd -> mail.listing.compact.even
|
||||
.Pp
|
||||
Two themes are included by default, `light` and `dark`.
|
||||
Two themes are included by default,
|
||||
.Ql light
|
||||
and
|
||||
.Ql dark Ns
|
||||
\&.
|
||||
.Sh EXAMPLES
|
||||
Specific settings from already defined themes can be overwritten:
|
||||
.Bd -literal
|
||||
|
@ -100,18 +105,18 @@ Custom themes can be included in your configuration files or be saved independen
|
|||
.Pa $XDG_CONFIG_HOME/meli/themes/
|
||||
directory as TOML files.
|
||||
To start creating a theme right away, you can begin by editing the default theme keys and values:
|
||||
.sp
|
||||
.Pp
|
||||
.Dl meli print-default-theme > ~/.config/meli/themes/new_theme.toml
|
||||
.sp
|
||||
.Pp
|
||||
.Pa new_theme.toml
|
||||
will now include all keys and values of the "dark" theme.
|
||||
.sp
|
||||
.Pp
|
||||
.Dl meli print-loaded-themes
|
||||
.sp
|
||||
.Pp
|
||||
will print all loaded themes with the links resolved.
|
||||
.Sh VALID ATTRIBUTE VALUES
|
||||
Case-sensitive.
|
||||
.Bl -bullet -compact
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
"Default"
|
||||
.It
|
||||
|
@ -133,7 +138,7 @@ Any combo of the above separated by a bitwise XOR "\&|" eg "Dim | Italics"
|
|||
.El
|
||||
.Sh VALID COLOR VALUES
|
||||
Color values are of type String with the following valid contents:
|
||||
.Bl -bullet -compact
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
"Default" is the terminal default. (Case-sensitive)
|
||||
.It
|
||||
|
@ -146,8 +151,10 @@ Three character shorthand is also valid, e.g. #09c ā #0099cc (Case-insensitive
|
|||
name but with some modifications (for a full table see COLOR NAMES addendum) (Case-sensitive)
|
||||
.El
|
||||
.Sh NO COLOR
|
||||
To completely disable ANSI colors, there are two options:
|
||||
.Bl -bullet -compact
|
||||
To completely disable
|
||||
.Tn ANSI
|
||||
colors, there are two options:
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
Set the
|
||||
.Ic use_color
|
||||
|
@ -157,17 +164,22 @@ option (section
|
|||
.It
|
||||
The
|
||||
.Ev NO_COLOR
|
||||
environmental variable, when present (regardless of its value), prevents the addition of ANSI color.
|
||||
environmental variable, when present (regardless of its value), prevents the addition of
|
||||
.Tn ANSI
|
||||
color.
|
||||
When the configuration value
|
||||
.Ic use_color
|
||||
is explicitly set to true by the user,
|
||||
.Ev NO_COLOR
|
||||
is ignored.
|
||||
.El
|
||||
.sp
|
||||
In this mode, cursor locations (i.e., currently selected entries/items) will use the "reverse video" ANSI attribute to invert the terminal's default foreground/background colors.
|
||||
.Pp
|
||||
In this mode, cursor locations (i.e., currently selected entries/items) will use the
|
||||
.Ql reverse video
|
||||
.Tn ANSI
|
||||
attribute to invert the terminal's default foreground/background colors.
|
||||
.Sh VALID KEYS
|
||||
.Bl -bullet -compact
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
theme_default
|
||||
.It
|
||||
|
@ -312,7 +324,7 @@ pager.highlight_search_current
|
|||
allbox tab(:);
|
||||
lb|lb|l|lb|lb
|
||||
l l|l|l l.
|
||||
name ā:byte:_:name:byte ā
|
||||
name \(da:byte:_:name:byte \(da
|
||||
Aqua:14:_:Black:0
|
||||
Aquamarine1:122:_:Maroon:1
|
||||
Aquamarine2:86:_:Green:2
|
||||
|
@ -348,7 +360,7 @@ DarkMagenta1:91:_:SpringGreen6:29
|
|||
allbox tab(:);
|
||||
lb|lb|l|lb|lb
|
||||
l l|l|l l.
|
||||
name ā:byte:_:name:byte ā
|
||||
name \(da:byte:_:name:byte \(da
|
||||
DarkOliveGreen1:192:_:Turquoise4:30
|
||||
DarkOliveGreen2:155:_:DeepSkyBlue3:31
|
||||
DarkOliveGreen3:191:_:DeepSkyBlue4:32
|
||||
|
@ -384,7 +396,7 @@ DeepPink4:125:_:Grey37:59
|
|||
allbox tab(:);
|
||||
lb|lb|l|lb|lb
|
||||
l l|l|l l.
|
||||
name ā:byte:_:name:byte ā
|
||||
name \(da:byte:_:name:byte \(da
|
||||
DeepPink6:162:_:MediumPurple6:60
|
||||
DeepPink7:89:_:SlateBlue2:61
|
||||
DeepPink8:53:_:SlateBlue3:62
|
||||
|
@ -420,7 +432,7 @@ Grey19:236:_:DeepPink7:89
|
|||
allbox tab(:);
|
||||
lb|lb|l|lb|lb
|
||||
l l|l|l l.
|
||||
name ā:byte:_:name:byte ā
|
||||
name \(da:byte:_:name:byte \(da
|
||||
Grey23:237:_:DarkMagenta:90
|
||||
Grey27:238:_:DarkMagenta1:91
|
||||
Grey3:232:_:DarkViolet1:92
|
||||
|
@ -456,7 +468,7 @@ HotPink2:169:_:LightGreen:119
|
|||
allbox tab(:);
|
||||
lb|lb|l|lb|lb
|
||||
l l|l|l l.
|
||||
name ā:byte:_:name:byte ā
|
||||
name \(da:byte:_:name:byte \(da
|
||||
HotPink3:132:_:LightGreen1:120
|
||||
HotPink4:168:_:PaleGreen1:121
|
||||
IndianRed:131:_:Aquamarine1:122
|
||||
|
@ -492,7 +504,7 @@ LightSlateGrey:103:_:DarkOliveGreen6:149
|
|||
allbox tab(:);
|
||||
lb|lb|l|lb|lb
|
||||
l l|l|l l.
|
||||
name ā:byte:_:name:byte ā
|
||||
name \(da:byte:_:name:byte \(da
|
||||
LightSteelBlue:147:_:DarkSeaGreen6:150
|
||||
LightSteelBlue1:189:_:DarkSeaGreen3:151
|
||||
LightSteelBlue3:146:_:LightCyan3:152
|
||||
|
@ -528,7 +540,7 @@ NavajoWhite3:144:_:LightGoldenrod3:179
|
|||
allbox tab(:);
|
||||
lb|lb|l|lb|lb
|
||||
l l|l|l l.
|
||||
name ā:byte:_:name:byte ā
|
||||
name \(da:byte:_:name:byte \(da
|
||||
Navy:4:_:Tan:180
|
||||
NavyBlue:17:_:MistyRose3:181
|
||||
Olive:3:_:Thistle3:182
|
||||
|
@ -564,7 +576,7 @@ Purple5:55:_:Salmon1:209
|
|||
allbox tab(:);
|
||||
lb|lb|l|lb|lb
|
||||
l l|l|l l.
|
||||
name ā:byte:_:name:byte ā
|
||||
name \(da:byte:_:name:byte \(da
|
||||
Red:9:_:LightCoral:210
|
||||
Red1:196:_:PaleVioletRed1:211
|
||||
Red2:124:_:Orchid2:212
|
||||
|
@ -600,7 +612,7 @@ Tan:180:_:Grey30:239
|
|||
allbox tab(:);
|
||||
lb|lb|l|lb|lb
|
||||
l l|l|l l.
|
||||
name ā:byte:_:name:byte ā
|
||||
name \(da:byte:_:name:byte \(da
|
||||
Teal:6:_:Grey35:240
|
||||
Thistle1:225:_:Grey39:241
|
||||
Thistle3:182:_:Grey42:242
|
||||
|
@ -621,15 +633,34 @@ Yellow6:148:_:Grey93:255
|
|||
.Sh SEE ALSO
|
||||
.Xr meli 1 ,
|
||||
.Xr meli.conf 5
|
||||
.Sh CONFORMING TO
|
||||
TOML Standard v.0.5.0 https://toml.io/en/v0.5.0
|
||||
.sp
|
||||
https://no-color.org/
|
||||
.Sh STANDARDS
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Lk https://toml.io/en/v0.5.0 "TOML Standard v.0.5.0"
|
||||
.It
|
||||
.Lk https://no\-color.org/ "NO_COLOR: disabling ANSI color output by default"
|
||||
.El
|
||||
.Sh AUTHORS
|
||||
Copyright 2017-2019
|
||||
.An Manos Pitsidianakis Aq epilys@nessuent.xyz
|
||||
Copyright 2017\(en2024
|
||||
.An Manos Pitsidianakis Aq Mt manos@pitsidianak.is
|
||||
.Pp
|
||||
Released under the GPL, version 3 or greater.
|
||||
This software carries no warranty of any kind.
|
||||
(See COPYING for full copyright and warranty notices.)
|
||||
.Pp
|
||||
.Aq https://meli.delivery
|
||||
.Po
|
||||
See
|
||||
.Pa COPYING
|
||||
for full copyright and warranty notices.
|
||||
.Pc
|
||||
.Ss Links
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Lk https://meli\-email.org "Website"
|
||||
.It
|
||||
.Lk https://git.meli\-email.org/meli/meli "Main\ git\ repository\ and\ issue\ tracker"
|
||||
.It
|
||||
.Lk https://codeberg.org/meli/meli "Official\ read-only\ git\ mirror\ on\ codeberg.org"
|
||||
.It
|
||||
.Lk https://github.com/meli/meli "Official\ read-only\ git\ mirror\ on\ github.com"
|
||||
.It
|
||||
.Lk https://crates.io/crates/meli "meli\ crate\ on\ crates.io"
|
||||
.El
|
||||
|
|
456
meli/docs/meli.1
456
meli/docs/meli.1
|
@ -17,6 +17,10 @@
|
|||
.\" You should have received a copy of the GNU General Public License
|
||||
.\" along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.de HorizontalRule
|
||||
.\"\l'\n(.l\(ru1.25'
|
||||
.sp
|
||||
..
|
||||
.de Shortcut
|
||||
.Sm
|
||||
.Aq \\$1
|
||||
|
@ -40,12 +44,13 @@
|
|||
.Ed
|
||||
.sp
|
||||
..
|
||||
.Dd November 11, 2022
|
||||
.\".Dd November 11, 2022
|
||||
.Dd March 10, 2024
|
||||
.Dt MELI 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm meli
|
||||
.Nd terminal e-mail client
|
||||
.Nd terminal e\-mail client
|
||||
.Em Ī¼ĪĪ»Ī¹
|
||||
is the Greek word for honey
|
||||
.Sh SYNOPSIS
|
||||
|
@ -65,36 +70,44 @@ Create configuration file in
|
|||
.Pa path
|
||||
if given, or at
|
||||
.Pa $XDG_CONFIG_HOME/meli/config.toml
|
||||
.It Cm edit-config
|
||||
Edit configuration files with
|
||||
.Ev EDITOR
|
||||
or
|
||||
.Ev VISUAL Ns
|
||||
\&.
|
||||
.It Cm test-config Op Ar path
|
||||
Test a configuration file for syntax issues or missing options.
|
||||
.It Cm man Op Ar page
|
||||
Print documentation page and exit (Piping to a pager is recommended).
|
||||
.It Cm install-man Op Ar path
|
||||
Install manual pages to the first location provided by
|
||||
.Ar MANPATH
|
||||
.Ev MANPATH
|
||||
or
|
||||
.Xr manpath 1 ,
|
||||
unless you specify the directory as an argument.
|
||||
.It Cm compiled-with
|
||||
Print compile time feature flags of this binary.
|
||||
.It Cm edit-config
|
||||
Edit configuration files with
|
||||
.Ev EDITOR
|
||||
or
|
||||
.Ev VISUAL Ns
|
||||
\&.
|
||||
.It Cm help
|
||||
Prints help information or the help of the given subcommand(s).
|
||||
.It Cm print-app-directories
|
||||
Print all directories that
|
||||
.Ns Nm
|
||||
creates and uses.
|
||||
.It Cm print-config-path
|
||||
Print location of configuration file that will be loaded on normal app startup.
|
||||
.It Cm print-default-theme
|
||||
Print default theme keys and values in TOML syntax, to be used as a blueprint.
|
||||
.It Cm print-loaded-themes
|
||||
Print all loaded themes in TOML syntax.
|
||||
.It Cm print-used-paths
|
||||
Print all paths that are created and used.
|
||||
.It Cm compiled-with
|
||||
Print compile time feature flags of this binary.
|
||||
.It Cm print-log-path
|
||||
Print log file location.
|
||||
.It Cm view
|
||||
View mail from input file.
|
||||
.El
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is a terminal mail client aiming for extensive and user-frendly configurability.
|
||||
is a terminal mail client aiming for extensive and user-friendly configurability.
|
||||
.Bd -literal
|
||||
^^ .-=-=-=-. ^^
|
||||
^^ (`-=-=-=-=-`) ^^
|
||||
|
@ -128,11 +141,28 @@ At any time, you may press
|
|||
for a searchable list of all available actions and shortcuts, along with every possible setting and command that your version supports.
|
||||
.Pp
|
||||
The main visual navigation tool, the left-side sidebar may be toggled with
|
||||
.ShortcutPeriod ` listing toggle_menu_visibility
|
||||
.ShortcutPeriod \(ga listing toggle_menu_visibility
|
||||
\&.
|
||||
.Pp
|
||||
Each mailbox may be viewed in 4 modes:
|
||||
Plain views each mail individually, Threaded shows their thread relationship visually, Conversations collapses each thread of emails into a single entry, Compact shows one row per thread.
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
.Tg index-style-plain
|
||||
.Em Plain
|
||||
views each mail individually,
|
||||
.It
|
||||
.Tg index-style-threaded
|
||||
.Em Threaded
|
||||
shows their thread relationship visually,
|
||||
.It
|
||||
.Tg index-style-conversations
|
||||
.Em Conversations
|
||||
collapses each thread of e\-mails into a single entry,
|
||||
.It
|
||||
.Tg index-style-compact
|
||||
.Em Compact
|
||||
shows one row per thread.
|
||||
.El
|
||||
.Pp
|
||||
If you're using a light color palette in your terminal, you should set
|
||||
.Em theme = "light"
|
||||
|
@ -148,6 +178,10 @@ See
|
|||
for a more detailed tutorial on using
|
||||
.Nm Ns
|
||||
\&.
|
||||
.Sh SHORTCUTS
|
||||
See
|
||||
.Xr meli.conf 5 SHORTCUTS
|
||||
for shortcuts and their default values.
|
||||
.Sh VIEWING MAIL
|
||||
Open attachments by typing their index in the attachments list and then
|
||||
.ShortcutPeriod a envelope_view open_attachment
|
||||
|
@ -173,7 +207,7 @@ If the path provided is a directory, the attachment is saved with its filename s
|
|||
If the 0th index is provided, the entire message is saved.
|
||||
If the path provided is a directory, the message is saved as an eml file with its filename set to the messages message-id.
|
||||
.Sh SEARCH
|
||||
Each e-mail storage backend has a default search method assigned.
|
||||
Each e\-mail storage backend has a default search method assigned.
|
||||
.Em IMAP
|
||||
uses the SEARCH command,
|
||||
.Em notmuch
|
||||
|
@ -222,9 +256,8 @@ alias:
|
|||
.Pc
|
||||
String keywords with spaces must be quoted.
|
||||
Quotes should always be escaped.
|
||||
.sp
|
||||
.Sy Important Notice about IMAP/JMAP
|
||||
.sp
|
||||
.Ss Important Notice about IMAP/JMAP
|
||||
.HorizontalRule
|
||||
To prevent downloading all your messages from your IMAP/JMAP server, don't set
|
||||
.Em search_backend
|
||||
to
|
||||
|
@ -233,9 +266,10 @@ to
|
|||
.Nm
|
||||
will relay your queries to the IMAP server.
|
||||
Expect a delay between query and response.
|
||||
Sqlite3 on the contrary at reasonable mailbox sizes should have a non noticable delay.
|
||||
Sqlite3 on the contrary at reasonable mailbox sizes should have a non noticeable delay.
|
||||
.Ss QUERY ABNF SYNTAX
|
||||
.Bl -bullet
|
||||
.HorizontalRule
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
.Li query = \&"(\&" query \&")\&" | from | to | cc | bcc | alladdresses | subject | flags | has_attachments | query \&"or\&" query | query \&"and\&" query | not query
|
||||
.It
|
||||
|
@ -265,10 +299,23 @@ Sqlite3 on the contrary at reasonable mailbox sizes should have a non noticable
|
|||
.It
|
||||
.Li flags = \&"flags:\&" flag | \&"tags:\&" flag | \&"is:\&" flag
|
||||
.El
|
||||
.Sh FLAGS
|
||||
.Nm
|
||||
supports the basic maildir flags: passed, replied, seen, trashed, draft and flagged.
|
||||
Flags can be searched with the
|
||||
.Ns Ql flags:
|
||||
prefix in a search query, and can be modified by
|
||||
.Command flag set FLAG
|
||||
and
|
||||
.Command flag unset FLAG
|
||||
.Sh TAGS
|
||||
.Nm
|
||||
supports tagging in notmuch and IMAP/JMAP backends.
|
||||
Tags can be searched with the `tags:` or `flags:` prefix in a search query, and can be modified by
|
||||
Tags can be searched with the
|
||||
.Ns Ql tags:
|
||||
or
|
||||
.Ns Ql flags:
|
||||
prefix in a search query, and can be modified by
|
||||
.Command tag add TAG
|
||||
and
|
||||
.Command tag remove TAG
|
||||
|
@ -289,7 +336,8 @@ To reply to a mail, press
|
|||
\&.
|
||||
Both these actions open the mail composer view in a new tab.
|
||||
.Ss Editing text
|
||||
.Bl -bullet -compact
|
||||
.HorizontalRule
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
Edit the header fields by selecting with the arrow keys and pressing
|
||||
.Shortcut Enter general focus_in_text_field
|
||||
|
@ -332,12 +380,14 @@ and to resume editing press the
|
|||
command again.
|
||||
.El
|
||||
.Ss Attachments
|
||||
.HorizontalRule
|
||||
Attachments may be handled with the
|
||||
.Cm add-attachment Ns
|
||||
,
|
||||
.Cm remove-attachment
|
||||
commands (see below).
|
||||
.Ss Sending
|
||||
.HorizontalRule
|
||||
Finally, pressing
|
||||
.Shortcut s composing send_mail
|
||||
will send your message according to your settings
|
||||
|
@ -355,6 +405,7 @@ On complete failure to save your draft or sent message it will be saved in your
|
|||
.Em tmp
|
||||
directory instead and you will be notified of its location.
|
||||
.Ss Drafts
|
||||
.HorizontalRule
|
||||
To save your draft without sending it, issue
|
||||
.Em COMMAND
|
||||
.Cm close
|
||||
|
@ -366,8 +417,7 @@ To open a draft for further editing, select your draft in the mail listing and p
|
|||
.Sh CONTACTS
|
||||
.Nm
|
||||
supports three kinds of contact backends:
|
||||
.sp
|
||||
.Bl -enum -compact -offset indent
|
||||
.Bl -enum -compact
|
||||
.It
|
||||
an internal format that gets saved under
|
||||
.Pa $XDG_DATA_HOME/meli/account_name/addressbook Ns
|
||||
|
@ -389,7 +439,7 @@ compatible alias file in the option
|
|||
.sp
|
||||
See
|
||||
.Xr meli.conf 5 ACCOUNTS
|
||||
for the complete account configuration values.
|
||||
for the complete account contact configuration values.
|
||||
.Sh MODES
|
||||
.Bl -tag -compact -width 8n
|
||||
.It NORMAL
|
||||
|
@ -409,8 +459,9 @@ captures all input as text input, and is exited with
|
|||
.Cm Esc
|
||||
key.
|
||||
.El
|
||||
.Ss COMMAND Mode
|
||||
.Sh COMMAND
|
||||
.Ss Mail listing commands
|
||||
.HorizontalRule
|
||||
.Bl -tag -width 36n
|
||||
.It Cm set Ar plain | threaded | compact | conversations
|
||||
set the way mailboxes are displayed
|
||||
|
@ -445,6 +496,8 @@ Escape exits search results.
|
|||
select threads matching
|
||||
.Ar STRING
|
||||
query.
|
||||
.It Cm clear-selection
|
||||
Clear current selection.
|
||||
.It Cm set seen, set unseen
|
||||
Set seen status of message.
|
||||
.It Cm import Ar FILEPATH Ar MAILBOX_PATH
|
||||
|
@ -452,25 +505,26 @@ Import mail from file into given mailbox.
|
|||
.It Cm copyto, moveto Ar MAILBOX_PATH
|
||||
Copy or move to other mailbox.
|
||||
.It Cm copyto, moveto Ar ACCOUNT Ar MAILBOX_PATH
|
||||
Copy or move to another account's mailbox.
|
||||
Copy or move to another account's mailbox.
|
||||
.It Cm delete
|
||||
Delete selected threads.
|
||||
.It Cm export-mbox Ar FILEPATH
|
||||
Export selected threads to mboxcl2 file.
|
||||
.It Cm create-mailbox Ar ACCOUNT Ar MAILBOX_PATH
|
||||
.It Cm create\-mailbox Ar ACCOUNT Ar MAILBOX_PATH
|
||||
create mailbox with given path.
|
||||
Be careful with backends and separator sensitivity (eg IMAP)
|
||||
.It Cm subscribe-mailbox Ar ACCOUNT Ar MAILBOX_PATH
|
||||
.It Cm subscribe\-mailbox Ar ACCOUNT Ar MAILBOX_PATH
|
||||
subscribe to mailbox with given path
|
||||
.It Cm unsubscribe-mailbox Ar ACCOUNT Ar MAILBOX_PATH
|
||||
.It Cm unsubscribe\-mailbox Ar ACCOUNT Ar MAILBOX_PATH
|
||||
unsubscribe to mailbox with given path
|
||||
.It Cm rename-mailbox Ar ACCOUNT Ar MAILBOX_PATH_SRC Ar MAILBOX_PATH_DEST
|
||||
.It Cm rename\-mailbox Ar ACCOUNT Ar MAILBOX_PATH_SRC Ar MAILBOX_PATH_DEST
|
||||
rename mailbox
|
||||
.It Cm delete-mailbox Ar ACCOUNT Ar MAILBOX_PATH
|
||||
.It Cm delete\-mailbox Ar ACCOUNT Ar MAILBOX_PATH
|
||||
deletes mailbox in the mail backend.
|
||||
This action is unreversible.
|
||||
This action is irreversible.
|
||||
.El
|
||||
.Ss Mail view commands
|
||||
.HorizontalRule
|
||||
.Bl -tag -width 36n
|
||||
.It Cm pipe Ar EXECUTABLE Ar ARGS
|
||||
pipe pager contents to binary
|
||||
|
@ -484,7 +538,8 @@ unsubscribe automatically from list of viewed envelope
|
|||
open list archive with
|
||||
.Cm xdg-open
|
||||
.El
|
||||
.Ss composing mail commands
|
||||
.Ss Composing mail commands
|
||||
.HorizontalRule
|
||||
.Bl -tag -width 36n
|
||||
.It Cm mailto Ar MAILTO_ADDRESS
|
||||
Opens a composer tab with initial values parsed from the
|
||||
|
@ -519,7 +574,8 @@ for PGP configuration.
|
|||
.It Cm save-draft
|
||||
saves a copy of the draft in the Draft folder
|
||||
.El
|
||||
.Ss generic commands
|
||||
.Ss Generic commands
|
||||
.HorizontalRule
|
||||
.Bl -tag -width 36n
|
||||
.It Cm open-in-tab
|
||||
opens envelope view in new tab
|
||||
|
@ -543,10 +599,6 @@ Useful if you want to reload some settings without restarting
|
|||
.Nm Ns
|
||||
\&.
|
||||
.El
|
||||
.Sh SHORTCUTS
|
||||
See
|
||||
.Xr meli.conf 5 SHORTCUTS
|
||||
for shortcuts and their default values.
|
||||
.Sh EXIT STATUS
|
||||
.Nm
|
||||
exits with 0 on a successful run.
|
||||
|
@ -564,7 +616,9 @@ Specifies the editor to use
|
|||
.It Ev MELI_CONFIG
|
||||
Override the configuration file
|
||||
.It Ev NO_COLOR
|
||||
When present (regardless of its value), prevents the addition of ANSI color.
|
||||
When defined (regardless of its value), prevents the addition of
|
||||
.Tn ANSI
|
||||
color.
|
||||
The configuration value
|
||||
.Ic use_color
|
||||
overrides this.
|
||||
|
@ -621,75 +675,265 @@ Mailcap entries are searched for in the following files, in this order:
|
|||
.It
|
||||
.Pa /usr/local/etc/mailcap
|
||||
.El
|
||||
.Sh STANDARDS
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
.Rs
|
||||
.%B XDG Base Directory Specification
|
||||
.%O Version 0.8
|
||||
.%A Waldo Bastian
|
||||
.%A Allison Karlitskaya
|
||||
.%A Lennart Poettering
|
||||
.%A Johannes Lƶthberg
|
||||
.%U https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
.%D May 08, 2021
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B maildir
|
||||
.%A Daniel J. Bernstein
|
||||
.%U https://cr.yp.to/proto/maildir.html
|
||||
.%D 1995
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC1524 A User Agent Configuration Mechanism For Multimedia Mail Format Information
|
||||
.%O mailcap file
|
||||
.%I Legacy
|
||||
.%D September 01, 1993
|
||||
.%A Dr. Nathaniel S. Borenstein
|
||||
.%U https://datatracker.ietf.org/doc/rfc1524/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC2047 MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text
|
||||
.%I IETF
|
||||
.%D November 01, 1996
|
||||
.%A Keith Moore
|
||||
.%U https://datatracker.ietf.org/doc/rfc2047/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC2183 Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field
|
||||
.%I Legacy
|
||||
.%D August 01, 1997
|
||||
.%A Rens Troost
|
||||
.%A Steve Dorner
|
||||
.%A Keith Moore
|
||||
.%U https://datatracker.ietf.org/doc/rfc2183/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC2369 The Use of URLs as Meta-Syntax for Core Mail List Commands and their Transport through Message Header Fields
|
||||
.%I Legacy
|
||||
.%D July 01, 1998
|
||||
.%A Joshua D. Baer
|
||||
.%A Grant Neufeld
|
||||
.%U https://datatracker.ietf.org/doc/rfc2369/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC2426 vCard MIME Directory Profile
|
||||
.%O vCard Version 3
|
||||
.%I IETF
|
||||
.%D September 01, 1998
|
||||
.%A Frank Dawson
|
||||
.%A Tim Howes
|
||||
.%U https://datatracker.ietf.org/doc/rfc2426/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC3156 MIME Security with OpenPGP
|
||||
.%I IETF
|
||||
.%D August 01, 2001
|
||||
.%A Thomas Roessler
|
||||
.%A Michael Elkins
|
||||
.%A Raph Levien
|
||||
.%A Dave Del Torto
|
||||
.%U https://datatracker.ietf.org/doc/rfc3156/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC3461 Simple Mail Transfer Protocol (SMTP) Service Extension for Delivery Status Notifications (DSNs)
|
||||
.%I IETF
|
||||
.%D January 23, 2003
|
||||
.%A Keith Moore
|
||||
.%U https://datatracker.ietf.org/doc/rfc3461/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC3501 INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1
|
||||
.%I IETF
|
||||
.%D March 18, 2003
|
||||
.%A Mark Crispin
|
||||
.%U https://datatracker.ietf.org/doc/rfc3501/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC3676 The Text/Plain Format and DelSp Parameters
|
||||
.%I IETF
|
||||
.%D February 19, 2004
|
||||
.%A Randall Gellens
|
||||
.%U https://datatracker.ietf.org/doc/rfc3676/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC3691 Internet Message Access Protocol (IMAP) UNSELECT command
|
||||
.%I IETF
|
||||
.%D February 20, 2004
|
||||
.%A Alexey Melnikov
|
||||
.%U https://datatracker.ietf.org/doc/rfc3691/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC3977 Network News Transfer Protocol (NNTP)
|
||||
.%I IETF
|
||||
.%D October 26, 2006
|
||||
.%A Clive Feather
|
||||
.%U https://datatracker.ietf.org/doc/rfc3977/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC4549 Synchronization Operations for Disconnected IMAP4 Clients
|
||||
.%I IETF
|
||||
.%D June 16, 2006
|
||||
.%A Alexey Melnikov
|
||||
.%U https://datatracker.ietf.org/doc/rfc4549/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC4616 The PLAIN Simple Authentication and Security Layer (SASL) Mechanism
|
||||
.%I IETF
|
||||
.%D August 31, 2006
|
||||
.%A Kurt Zeilenga
|
||||
.%U https://datatracker.ietf.org/doc/rfc4616/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC4954 SMTP Service Extension for Authentication
|
||||
.%I IETF
|
||||
.%D July 23, 2007
|
||||
.%A Rob Siemborski
|
||||
.%A Alexey Melnikov
|
||||
.%U https://datatracker.ietf.org/doc/rfc4954/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC5321 Simple Mail Transfer Protocol
|
||||
.%I IETF
|
||||
.%D October 01, 2008
|
||||
.%A Dr. John C. Klensin
|
||||
.%U https://datatracker.ietf.org/doc/rfc5321/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC5322 Internet Message Format
|
||||
.%I IETF
|
||||
.%D October 01, 2008
|
||||
.%A Pete Resnick
|
||||
.%U https://datatracker.ietf.org/doc/rfc5322/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC6048 Network News Transfer Protocol (NNTP) Additions to LIST Command
|
||||
.%I IETF
|
||||
.%D November 22, 2010
|
||||
.%A Julien ĆLIE
|
||||
.%U https://datatracker.ietf.org/doc/rfc6048/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC6152 SMTP Service Extension for 8-bit MIME Transport
|
||||
.%I IETF
|
||||
.%D March 07, 2011
|
||||
.%A Dave Crocker
|
||||
.%A Dr. John C. Klensin
|
||||
.%A Dr. Marshall T. Rose
|
||||
.%A Ned Freed
|
||||
.%U https://datatracker.ietf.org/doc/rfc6152/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC6350 vCard Format Specification
|
||||
.%O vCard Version 4
|
||||
.%I IETF
|
||||
.%D August 31, 2011
|
||||
.%A Simon Perreault
|
||||
.%U https://datatracker.ietf.org/doc/rfc6350/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC6532 Internationalized Email Headers
|
||||
.%I IETF
|
||||
.%D February 17, 2012
|
||||
.%A Abel Yang
|
||||
.%A Shawn Steele
|
||||
.%A Ned Freed
|
||||
.%U https://datatracker.ietf.org/doc/rfc6532/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC6868 Parameter Value Encoding in iCalendar and vCard
|
||||
.%I IETF
|
||||
.%D February 14, 2013
|
||||
.%A Cyrus Daboo
|
||||
.%U https://datatracker.ietf.org/doc/rfc6868/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC7162 IMAP Extensions: Quick Flag Changes Resynchronization (CONDSTORE) and Quick Mailbox Resynchronization (QRESYNC)
|
||||
.%I IETF
|
||||
.%D May 23, 2014
|
||||
.%A Alexey Melnikov
|
||||
.%A Dave Cridland
|
||||
.%U https://datatracker.ietf.org/doc/rfc7162/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC8620 The JSON Meta Application Protocol (JMAP)
|
||||
.%I IETF
|
||||
.%D July 18, 2019
|
||||
.%A Neil Jenkins
|
||||
.%A Chris Newman
|
||||
.%U https://datatracker.ietf.org/doc/rfc8620/
|
||||
.Re
|
||||
.It
|
||||
.Rs
|
||||
.%B RFC8621 The JSON Meta Application Protocol (JMAP) for Mail
|
||||
.%I IETF
|
||||
.%D August 08, 2019
|
||||
.%A Neil Jenkins
|
||||
.%A Chris Newman
|
||||
.%U https://datatracker.ietf.org/doc/rfc8621/
|
||||
.Re
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr meli.conf 5 ,
|
||||
.Xr meli-themes 5 ,
|
||||
.Xr meli 7 ,
|
||||
.Xr xdg-open 1 ,
|
||||
.Xr mailcap 5
|
||||
.Sh CONFORMING TO
|
||||
.Bl -bullet -compact
|
||||
.It
|
||||
XDG Standard
|
||||
.Lk https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html Ns
|
||||
\&.
|
||||
.It
|
||||
mailcap file, RFC 1524: A User Agent Configuration Mechanism For Multimedia Mail Format Information
|
||||
.It
|
||||
RFC 5322: Internet Message Format
|
||||
.It
|
||||
RFC 6532: Internationalized Email Headers
|
||||
.It
|
||||
RFC 2047: MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text
|
||||
.It
|
||||
RFC 3676: The Text/Plain Format and DelSp Parameters
|
||||
.It
|
||||
RFC 3156: MIME Security with OpenPGP
|
||||
.It
|
||||
RFC 2183: Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field
|
||||
.It
|
||||
RFC 2369: The Use of URLs as Meta-Syntax for Core Mail List Commands and their Transport through Message Header Fields
|
||||
.It
|
||||
.Li maildir
|
||||
.Lk https://cr.yp.to/proto/maildir.html Ns
|
||||
\&.
|
||||
.It
|
||||
RFC 5321: Simple Mail Transfer Protocol
|
||||
.It
|
||||
RFC 3461: Simple Mail Transfer Protocol (SMTP) Service Extension for Delivery Status Notifications (DSNs)
|
||||
.It
|
||||
RFC 4954: SMTP Service Extension for Authentication
|
||||
.It
|
||||
RFC 6152: SMTP Service Extension for 8-bit MIME Transport
|
||||
.It
|
||||
RFC 4616: The PLAIN Simple Authentication and Security Layer (SASL) Mechanism
|
||||
.It
|
||||
RFC 3501: INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1
|
||||
.It
|
||||
RFC 3691: Internet Message Access Protocol (IMAP) UNSELECT command
|
||||
.It
|
||||
RFC 4549: Synch Ops for Disconnected IMAP4 Clients
|
||||
.It
|
||||
RFC 7162: IMAP Extensions: Quick Flag Changes Resynchronization (CONDSTORE) and Quick Mailbox Resynchronization (QRESYNC)
|
||||
.It
|
||||
RFC 8620: The JSON Meta Application Protocol (JMAP)
|
||||
.It
|
||||
RFC 8621: The JSON Meta Application Protocol (JMAP) for Mail
|
||||
.It
|
||||
RFC 3977: Network News Transfer Protocol (NNTP)
|
||||
.It
|
||||
RFC 6048: Network News Transfer Protocol (NNTP) Additions to LIST Command
|
||||
.It
|
||||
vCard Version 3, RFC 2426: vCard MIME Directory Profile
|
||||
.It
|
||||
vCard Version 4, RFC 6350: vCard Format Specification
|
||||
.It
|
||||
RFC 6868 Parameter Value Encoding in iCalendar and vCard
|
||||
.El
|
||||
.Sh AUTHORS
|
||||
Copyright 2017-2022
|
||||
.An Manos Pitsidianakis Mt manos@pitsidianak.is
|
||||
Released under the GPL, version 3 or greater.
|
||||
This software carries no warranty of any kind (See COPYING for full copyright and warranty notices).
|
||||
Copyright 2017\(en2024
|
||||
.An Manos Pitsidianakis Aq Mt manos@pitsidianak.is
|
||||
.Pp
|
||||
.Lk https://meli.delivery
|
||||
Released under the GPL, version 3 or greater.
|
||||
This software carries no warranty of any kind.
|
||||
.Po
|
||||
See
|
||||
.Pa COPYING
|
||||
for full copyright and warranty notices.
|
||||
.Pc
|
||||
.Ss Links
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Lk https://meli\-email.org "Website"
|
||||
.It
|
||||
.Lk https://git.meli\-email.org/meli/meli "Main\ git\ repository\ and\ issue\ tracker"
|
||||
.It
|
||||
.Lk https://codeberg.org/meli/meli "Official\ read-only\ git\ mirror\ on\ codeberg.org"
|
||||
.It
|
||||
.Lk https://github.com/meli/meli "Official\ read-only\ git\ mirror\ on\ github.com"
|
||||
.It
|
||||
.Lk https://crates.io/crates/meli "meli\ crate\ on\ crates.io"
|
||||
.El
|
||||
|
|
126
meli/docs/meli.7
126
meli/docs/meli.7
|
@ -40,22 +40,23 @@
|
|||
.Pc Ns
|
||||
..
|
||||
.de Command
|
||||
.Bd -offset 1n -ragged
|
||||
.Bd -ragged -offset 1n
|
||||
.Cm \\$*
|
||||
.Ed
|
||||
..
|
||||
.Dd November 11, 2022
|
||||
.\".Dd November 11, 2022
|
||||
.Dd March 10, 2024
|
||||
.Dt MELI 7
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm meli
|
||||
.Nd Tutorial for the meli terminal e-mail client
|
||||
.Nd Tutorial for the meli terminal e\-mail client
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op ...
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is a terminal mail client aiming for extensive and user-frendly configurability.
|
||||
is a terminal mail client aiming for extensive and user\-friendly configurability.
|
||||
.Bd -literal -offset center
|
||||
^^ .-=-=-=-. ^^
|
||||
^^ (`-=-=-=-=-`) ^^
|
||||
|
@ -158,9 +159,9 @@ key.
|
|||
.It EMBED
|
||||
This is the mode of the embed terminal emulator.
|
||||
To exit an embedded application, issue
|
||||
.Aq Ctrl-C
|
||||
.Aq Ctrl\-C
|
||||
to kill it or
|
||||
.Aq Ctrl-Z
|
||||
.Aq Ctrl\-Z
|
||||
to stop the program and follow the instructions on
|
||||
.Nm
|
||||
to exit.
|
||||
|
@ -229,7 +230,7 @@ This is the view you will spend more time with in
|
|||
\&.
|
||||
.Pp
|
||||
Press
|
||||
.Shortcut ` listing toggle_menu_visibility
|
||||
.Shortcut \(ga listing toggle_menu_visibility
|
||||
to toggle the sidebars visibility.
|
||||
.Pp
|
||||
Press
|
||||
|
@ -237,16 +238,16 @@ Press
|
|||
to switch focus on the sidebar menu.
|
||||
Press
|
||||
.Shortcut Right listing focus_left
|
||||
to switch focus on the e-mail list.
|
||||
to switch focus on the e\-mail list.
|
||||
.Pp
|
||||
On the e-mail list, press
|
||||
On the e\-mail list, press
|
||||
.Shortcut k listing scroll_up
|
||||
to scroll up, and
|
||||
.Shortcut j listing scroll_down
|
||||
to scroll down.
|
||||
Press
|
||||
.Shortcut Enter listing open_entry
|
||||
to open an e-mail entry and
|
||||
to open an e\-mail entry and
|
||||
.Shortcut i listing exit_entry
|
||||
to exit it.
|
||||
.Bd -ragged
|
||||
|
@ -294,9 +295,9 @@ See
|
|||
for details.
|
||||
.Pp
|
||||
You can increase the sidebar's width with
|
||||
.Shortcut Ctrl-p listing increase_sidebar
|
||||
.Shortcut Ctrl\-p listing increase_sidebar
|
||||
and decrease with
|
||||
.ShortcutPeriod Ctrl-o listing decrease_sidebar
|
||||
.ShortcutPeriod Ctrl\-o listing decrease_sidebar
|
||||
\&.
|
||||
.Bd -ragged
|
||||
.Sy The status bar.
|
||||
|
@ -310,7 +311,7 @@ and decrease with
|
|||
The status bar shows which mode you are, and the status message of the current view.
|
||||
In the pictured example, it shows the status of a mailbox called
|
||||
.Dq Inbox
|
||||
with lots of e-mails.
|
||||
with lots of e\-mails.
|
||||
.Bd -ragged
|
||||
.Sy The number modifier buffer.
|
||||
.Ed
|
||||
|
@ -330,7 +331,7 @@ entries.
|
|||
Another use of the number buffer is opening URLs inside the pager.
|
||||
See
|
||||
.Sx PAGER
|
||||
for an explanation of interacting with URLs in e-mails.
|
||||
for an explanation of interacting with URLs in e\-mails.
|
||||
.Pp
|
||||
Pressing numbers in
|
||||
.Sy NORMAL
|
||||
|
@ -343,16 +344,16 @@ There are four different list styles:
|
|||
.Bl -hyphen -compact
|
||||
.It
|
||||
.Qq plain
|
||||
which shows one line per e-mail.
|
||||
which shows one line per e\-mail.
|
||||
.It
|
||||
.Qq threaded
|
||||
which shows a threaded view with drawn tree structure.
|
||||
.It
|
||||
.Qq compact
|
||||
which shows one line per thread which can include multiple e-mails.
|
||||
which shows one line per thread which can include multiple e\-mails.
|
||||
.It
|
||||
.Qq conversations
|
||||
which shows more than one line per thread which can include multiple e-mails with more details about the thread.
|
||||
which shows more than one line per thread which can include multiple e\-mails with more details about the thread.
|
||||
.El
|
||||
.Bd -ragged
|
||||
.Sy Plain view\&.
|
||||
|
@ -421,13 +422,13 @@ Simple set operations can be performed on a selection with these shortcut modifi
|
|||
.Bl -hyphen -compact
|
||||
.It
|
||||
Union modifier:
|
||||
.Shortcut Ctrl-u listing union_modifier
|
||||
.Shortcut Ctrl\-u listing union_modifier
|
||||
.It
|
||||
Difference modifier:
|
||||
.Shortcut Ctrl-d listing diff_modifier
|
||||
.Shortcut Ctrl\-d listing diff_modifier
|
||||
.It
|
||||
Intersection modifier:
|
||||
.Shortcut Ctrl-i listing intersection_modifier
|
||||
.Shortcut Ctrl\-i listing intersection_modifier
|
||||
.El
|
||||
.Pp
|
||||
To set an entry as
|
||||
|
@ -445,7 +446,11 @@ which also has its complement
|
|||
.sp
|
||||
action.
|
||||
.Pp
|
||||
For e-mail backends that support tags
|
||||
For e\-mail backends that support flags you can use the following commands on entries and selections to modify them:
|
||||
.Command flag set FLAG
|
||||
.Command flag unset FLAG
|
||||
.Pp
|
||||
For e\-mail backends that support tags
|
||||
.Po
|
||||
like
|
||||
.Qq IMAP
|
||||
|
@ -463,10 +468,13 @@ you can use the following commands on entries and selections to modify them:
|
|||
and
|
||||
.Ic ignore_tags
|
||||
for how to set tag colors and tag visibility)
|
||||
You can clear the selection with the
|
||||
.Aq Esc
|
||||
key.
|
||||
.Sh PAGER
|
||||
You can open an e-mail entry by pressing
|
||||
You can open an e\-mail entry by pressing
|
||||
.ShortcutPeriod Enter listing open_entry
|
||||
\&. This brings up the e-mail view with the e-mail content inside a pager.
|
||||
\&. This brings up the e\-mail view with the e\-mail content inside a pager.
|
||||
.Bd -literal -offset center
|
||||
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
||||
āDate: Sat, 21 May 2022 16:16:11 +0300 āā
|
||||
|
@ -494,14 +502,14 @@ You can open an e-mail entry by pressing
|
|||
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
||||
.Ed
|
||||
.Bd -ragged -offset 3n
|
||||
.Em The\ pager\ displaying\ an\ e-mail\&.
|
||||
.Em The\ pager\ displaying\ an\ e\-mail\&.
|
||||
.Ed
|
||||
.Pp
|
||||
The pager is simple to use.
|
||||
Scroll with the following:
|
||||
.Bl -hang -width 27n
|
||||
.It Go to next pager page
|
||||
.Shortcut PageDown pager page_down
|
||||
.Shortcut PageDown pager page_down
|
||||
.It Go to previous pager page
|
||||
.Shortcut PageUp pager page_up
|
||||
.It Scroll down pager.
|
||||
|
@ -516,7 +524,7 @@ which will act as a multiplier.
|
|||
.Pp
|
||||
The pager can enter a special
|
||||
.Em url
|
||||
mode which will prefix all detected hyperlinks and e-mail addresses with a number inside square brackets
|
||||
mode which will prefix all detected hyperlinks and e\-mail addresses with a number inside square brackets
|
||||
.ShortcutPeriod u pager toggle_url_mode
|
||||
\&.
|
||||
Writing down a chosen number as a number modifier
|
||||
|
@ -547,13 +555,13 @@ for more details
|
|||
.Pc Ns
|
||||
\&.
|
||||
.Sh MAIL VIEW
|
||||
Other things you can do when viewing e-mail:
|
||||
.Bl -bullet -compact
|
||||
Other things you can do when viewing e\-mail:
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
Most importantly, you can exit the mail view with:
|
||||
.Shortcut i listing exit_entry
|
||||
.It
|
||||
Add addresses from the e-mail headers to contacts:
|
||||
Add addresses from the e\-mail headers to contacts:
|
||||
.Shortcut c envelope_view add_addresses_to_contacts
|
||||
.It
|
||||
Open an attachment by entering its index as a number modifier and pressing:
|
||||
|
@ -569,39 +577,39 @@ Reply to envelope:
|
|||
.Shortcut R envelope_view reply
|
||||
.It
|
||||
Reply to author:
|
||||
.Shortcut Ctrl-r envelope_view reply_to_author
|
||||
.Shortcut Ctrl\-r envelope_view reply_to_author
|
||||
.It
|
||||
Reply to all/Reply to list/Follow up:
|
||||
.Shortcut Ctrl-g envelope_view reply_to_all
|
||||
.Shortcut Ctrl\-g envelope_view reply_to_all
|
||||
.It
|
||||
Forward email:
|
||||
.Shortcut Ctrl-f envelope_view forward
|
||||
Forward e\-mail:
|
||||
.Shortcut Ctrl\-f envelope_view forward
|
||||
.It
|
||||
Expand extra headers: (References and others)
|
||||
.Shortcut h envelope_view toggle_expand_headerk
|
||||
.It
|
||||
View envelope source in a pager: (toggles between raw and decoded source)
|
||||
.Shortcut M-r envelope_view view_raw_source
|
||||
.Shortcut M\-r envelope_view view_raw_source
|
||||
.It
|
||||
Return to envelope_view if viewing raw source or attachment:
|
||||
.Shortcut r envelope_view return_to_normal_view
|
||||
.El
|
||||
.Sh COMPOSING
|
||||
To compose an e-mail, you can either start with an empty draft by pressing
|
||||
To compose an e\-mail, you can either start with an empty draft by pressing
|
||||
.Shortcut m listing new_mail
|
||||
which opens a composer view in a new tab.
|
||||
To reply to a specific e-mail, when in envelope view you can select the specific action you want to take:
|
||||
To reply to a specific e\-mail, when in envelope view you can select the specific action you want to take:
|
||||
.sp
|
||||
.Bl -bullet -compact
|
||||
.Bl -dash -compact
|
||||
.It
|
||||
Reply to envelope.
|
||||
.Shortcut R envelope_view reply
|
||||
.It
|
||||
Reply to author.
|
||||
.Shortcut Ctrl-r envelope_view reply_to_author
|
||||
.Shortcut Ctrl\-r envelope_view reply_to_author
|
||||
.It
|
||||
Reply to all.
|
||||
.Shortcut Ctrl-g envelope_view reply_to_all
|
||||
.Shortcut Ctrl\-g envelope_view reply_to_all
|
||||
.El
|
||||
.sp
|
||||
To launch your editor, press
|
||||
|
@ -688,25 +696,25 @@ the\ actual\ embedding\ is\ seamless\&.
|
|||
.Ed
|
||||
.Ss composing mail commands
|
||||
.Bl -tag -width 36n
|
||||
.It Cm add-attachment Ar PATH
|
||||
.It Cm add\-attachment Ar PATH
|
||||
in composer, add
|
||||
.Ar PATH
|
||||
as an attachment
|
||||
.It Cm add-attachment < Ar CMD Ar ARGS
|
||||
.It Cm add\-attachment < Ar CMD Ar ARGS
|
||||
in composer, pipe
|
||||
.Ar CMD Ar ARGS
|
||||
output into an attachment
|
||||
.It Cm add-attachment-file-picker
|
||||
.It Cm add\-attachment\-file\-picker
|
||||
Launch command defined in the configuration value
|
||||
.Ic file_picker_command
|
||||
in
|
||||
.Xr meli.conf 5 TERMINAL
|
||||
.It Cm add-attachment-file-picker < Ar CMD Ar ARGS
|
||||
.It Cm add\-attachment\-file\-picker < Ar CMD Ar ARGS
|
||||
Launch command
|
||||
.Ar CMD Ar ARGS Ns
|
||||
\&.
|
||||
The command should print file paths in stderr, separated by NULL bytes.
|
||||
.It Cm remove-attachment Ar INDEX
|
||||
.It Cm remove\-attachment Ar INDEX
|
||||
remove attachment with given index
|
||||
.It Cm toggle sign
|
||||
toggle between signing and not signing this message.
|
||||
|
@ -714,7 +722,7 @@ If the gpg invocation fails then the mail won't be sent.
|
|||
See
|
||||
.Xr meli.conf 5 PGP
|
||||
for PGP configuration.
|
||||
.It Cm save-draft
|
||||
.It Cm save\-draft
|
||||
saves a copy of the draft in the Draft folder
|
||||
.El
|
||||
.\" [ref:TODO]: add contacts section
|
||||
|
@ -731,12 +739,26 @@ for documentation on how to theme
|
|||
.Xr xdg-open 1 ,
|
||||
.Xr mailcap 5
|
||||
.Sh AUTHORS
|
||||
Copyright 2017-2022
|
||||
.An Manos Pitsidianakis Mt manos@pitsidianak.is
|
||||
Copyright 2017\(en2024
|
||||
.An Manos Pitsidianakis Aq Mt manos@pitsidianak.is
|
||||
.Pp
|
||||
Released under the GPL, version 3 or greater.
|
||||
This software carries no warranty of any kind.
|
||||
(See COPYING for full copyright and warranty notices.)
|
||||
.Pp
|
||||
.Lk https://meli.delivery
|
||||
.Lk https://github.com/meli/meli
|
||||
.Lk https://crates.io/crates/meli
|
||||
.Po
|
||||
See
|
||||
.Pa COPYING
|
||||
for full copyright and warranty notices.
|
||||
.Pc
|
||||
.Ss Links
|
||||
.Bl -item -compact
|
||||
.It
|
||||
.Lk https://meli\-email.org "Website"
|
||||
.It
|
||||
.Lk https://git.meli\-email.org/meli/meli "Main\ git\ repository\ and\ issue\ tracker"
|
||||
.It
|
||||
.Lk https://codeberg.org/meli/meli "Official\ read-only\ git\ mirror\ on\ codeberg.org"
|
||||
.It
|
||||
.Lk https://github.com/meli/meli "Official\ read-only\ git\ mirror\ on\ github.com"
|
||||
.It
|
||||
.Lk https://crates.io/crates/meli "meli\ crate\ on\ crates.io"
|
||||
.El
|
||||
|
|
File diff suppressed because it is too large
Load Diff
1178
meli/src/accounts.rs
1178
meli/src/accounts.rs
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* meli - accounts module.
|
||||
*
|
||||
* Copyright 2023 Manos Pitsidianakis
|
||||
*
|
||||
* This file is part of meli.
|
||||
*
|
||||
* meli is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* meli is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//! Account mail backend operations.
|
||||
|
||||
use super::*;
|
||||
|
||||
impl Account {
|
||||
pub fn set_flags(
|
||||
&mut self,
|
||||
env_hashes: EnvelopeHashBatch,
|
||||
mailbox_hash: MailboxHash,
|
||||
flags: SmallVec<[FlagOp; 8]>,
|
||||
) -> Result<JobId> {
|
||||
let fut = self.backend.write().unwrap().set_flags(
|
||||
env_hashes.clone(),
|
||||
mailbox_hash,
|
||||
flags.clone(),
|
||||
)?;
|
||||
let handle = self
|
||||
.main_loop_handler
|
||||
.job_executor
|
||||
.spawn_specialized("set_flags".into(), fut);
|
||||
let job_id = handle.job_id;
|
||||
self.insert_job(
|
||||
job_id,
|
||||
JobRequest::SetFlags {
|
||||
env_hashes,
|
||||
mailbox_hash,
|
||||
flags,
|
||||
handle,
|
||||
},
|
||||
);
|
||||
|
||||
Ok(job_id)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "sqlite3"))]
|
||||
pub(super) fn update_cached_env(&mut self, _: Envelope, _: Option<EnvelopeHash>) {}
|
||||
|
||||
#[cfg(feature = "sqlite3")]
|
||||
pub(super) fn update_cached_env(&mut self, env: Envelope, old_hash: Option<EnvelopeHash>) {
|
||||
if self.settings.conf.search_backend == crate::conf::SearchBackend::Sqlite3 {
|
||||
let msg_id = env.message_id_display().to_string();
|
||||
let name = self.name.clone();
|
||||
let backend = self.backend.clone();
|
||||
let fut = async move {
|
||||
crate::sqlite3::AccountCache::remove(
|
||||
name.clone(),
|
||||
old_hash.unwrap_or_else(|| env.hash()),
|
||||
)
|
||||
.await?;
|
||||
|
||||
crate::sqlite3::AccountCache::insert(env, backend, name).await?;
|
||||
Ok(())
|
||||
};
|
||||
let handle = self
|
||||
.main_loop_handler
|
||||
.job_executor
|
||||
.spawn_specialized("sqlite3::remove".into(), fut);
|
||||
self.insert_job(
|
||||
handle.job_id,
|
||||
JobRequest::Generic {
|
||||
name: format!("Update envelope {} in sqlite3 cache", msg_id).into(),
|
||||
handle,
|
||||
log_level: LogLevel::TRACE,
|
||||
on_finish: None,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,222 @@
|
|||
//
|
||||
// meli - accounts module.
|
||||
//
|
||||
// Copyright 2017 Emmanouil Pitsidianakis <manos@pitsidianak.is>
|
||||
//
|
||||
// This file is part of meli.
|
||||
//
|
||||
// meli is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// meli is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// SPDX-License-Identifier: EUPL-1.2 OR GPL-3.0-or-later
|
||||
|
||||
use std::{borrow::Cow, collections::HashMap, pin::Pin};
|
||||
|
||||
use futures::stream::Stream;
|
||||
use melib::{backends::*, email::*, error::Result, LogLevel};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::{is_variant, jobs::JoinHandle};
|
||||
|
||||
pub enum JobRequest {
|
||||
Mailboxes {
|
||||
handle: JoinHandle<Result<HashMap<MailboxHash, Mailbox>>>,
|
||||
},
|
||||
Fetch {
|
||||
mailbox_hash: MailboxHash,
|
||||
#[allow(clippy::type_complexity)]
|
||||
handle: JoinHandle<(
|
||||
Option<Result<Vec<Envelope>>>,
|
||||
Pin<Box<dyn Stream<Item = Result<Vec<Envelope>>> + Send + 'static>>,
|
||||
)>,
|
||||
},
|
||||
Generic {
|
||||
name: Cow<'static, str>,
|
||||
log_level: LogLevel,
|
||||
handle: JoinHandle<Result<()>>,
|
||||
on_finish: Option<crate::types::CallbackFn>,
|
||||
},
|
||||
IsOnline {
|
||||
handle: JoinHandle<Result<()>>,
|
||||
},
|
||||
Refresh {
|
||||
mailbox_hash: MailboxHash,
|
||||
handle: JoinHandle<Result<()>>,
|
||||
},
|
||||
SetFlags {
|
||||
env_hashes: EnvelopeHashBatch,
|
||||
mailbox_hash: MailboxHash,
|
||||
flags: SmallVec<[FlagOp; 8]>,
|
||||
handle: JoinHandle<Result<()>>,
|
||||
},
|
||||
SaveMessage {
|
||||
bytes: Vec<u8>,
|
||||
mailbox_hash: MailboxHash,
|
||||
handle: JoinHandle<Result<()>>,
|
||||
},
|
||||
SendMessage,
|
||||
SendMessageBackground {
|
||||
handle: JoinHandle<Result<()>>,
|
||||
},
|
||||
DeleteMessages {
|
||||
env_hashes: EnvelopeHashBatch,
|
||||
handle: JoinHandle<Result<()>>,
|
||||
},
|
||||
CreateMailbox {
|
||||
path: String,
|
||||
handle: JoinHandle<Result<(MailboxHash, HashMap<MailboxHash, Mailbox>)>>,
|
||||
},
|
||||
DeleteMailbox {
|
||||
mailbox_hash: MailboxHash,
|
||||
handle: JoinHandle<Result<HashMap<MailboxHash, Mailbox>>>,
|
||||
},
|
||||
//RenameMailbox,
|
||||
SetMailboxPermissions {
|
||||
mailbox_hash: MailboxHash,
|
||||
handle: JoinHandle<Result<()>>,
|
||||
},
|
||||
SetMailboxSubscription {
|
||||
mailbox_hash: MailboxHash,
|
||||
new_value: bool,
|
||||
handle: JoinHandle<Result<()>>,
|
||||
},
|
||||
Watch {
|
||||
handle: JoinHandle<Result<()>>,
|
||||
},
|
||||
}
|
||||
|
||||
impl Drop for JobRequest {
|
||||
fn drop(&mut self) {
|
||||
match self {
|
||||
Self::Generic { handle, .. } |
|
||||
Self::IsOnline { handle, .. } |
|
||||
Self::Refresh { handle, .. } |
|
||||
Self::SetFlags { handle, .. } |
|
||||
Self::SaveMessage { handle, .. } |
|
||||
//JobRequest::RenameMailbox,
|
||||
Self::SetMailboxPermissions { handle, .. } |
|
||||
Self::SetMailboxSubscription { handle, .. } |
|
||||
Self::Watch { handle, .. } |
|
||||
Self::SendMessageBackground { handle, .. } => {
|
||||
handle.cancel();
|
||||
}
|
||||
Self::DeleteMessages { handle, .. } => {
|
||||
handle.cancel();
|
||||
}
|
||||
Self::CreateMailbox { handle, .. } => {
|
||||
handle.cancel();
|
||||
}
|
||||
Self::DeleteMailbox { handle, .. } => {
|
||||
handle.cancel();
|
||||
}
|
||||
Self::Fetch { handle, .. } => {
|
||||
handle.cancel();
|
||||
}
|
||||
Self::Mailboxes { handle, .. } => {
|
||||
handle.cancel();
|
||||
}
|
||||
Self::SendMessage => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for JobRequest {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Generic { name, .. } => write!(f, "JobRequest::Generic({})", name),
|
||||
Self::Mailboxes { .. } => write!(f, "JobRequest::Mailboxes"),
|
||||
Self::Fetch { mailbox_hash, .. } => {
|
||||
write!(f, "JobRequest::Fetch({})", mailbox_hash)
|
||||
}
|
||||
Self::IsOnline { .. } => write!(f, "JobRequest::IsOnline"),
|
||||
Self::Refresh { .. } => write!(f, "JobRequest::Refresh"),
|
||||
Self::SetFlags {
|
||||
env_hashes,
|
||||
mailbox_hash,
|
||||
flags,
|
||||
..
|
||||
} => f
|
||||
.debug_struct(stringify!(JobRequest::SetFlags))
|
||||
.field("env_hashes", &env_hashes)
|
||||
.field("mailbox_hash", &mailbox_hash)
|
||||
.field("flags", &flags)
|
||||
.finish(),
|
||||
Self::SaveMessage { .. } => write!(f, "JobRequest::SaveMessage"),
|
||||
Self::DeleteMessages { .. } => write!(f, "JobRequest::DeleteMessages"),
|
||||
Self::CreateMailbox { .. } => write!(f, "JobRequest::CreateMailbox"),
|
||||
Self::DeleteMailbox { mailbox_hash, .. } => {
|
||||
write!(f, "JobRequest::DeleteMailbox({})", mailbox_hash)
|
||||
}
|
||||
//JobRequest::RenameMailbox,
|
||||
Self::SetMailboxPermissions { .. } => {
|
||||
write!(f, "JobRequest::SetMailboxPermissions")
|
||||
}
|
||||
Self::SetMailboxSubscription { .. } => {
|
||||
write!(f, "JobRequest::SetMailboxSubscription")
|
||||
}
|
||||
Self::Watch { .. } => write!(f, "JobRequest::Watch"),
|
||||
Self::SendMessage => write!(f, "JobRequest::SendMessage"),
|
||||
Self::SendMessageBackground { .. } => {
|
||||
write!(f, "JobRequest::SendMessageBackground")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for JobRequest {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Generic { name, .. } => write!(f, "{}", name),
|
||||
Self::Mailboxes { .. } => write!(f, "Get mailbox list"),
|
||||
Self::Fetch { .. } => write!(f, "Mailbox fetch"),
|
||||
Self::IsOnline { .. } => write!(f, "Online status check"),
|
||||
Self::Refresh { .. } => write!(f, "Refresh mailbox"),
|
||||
Self::SetFlags {
|
||||
env_hashes, flags, ..
|
||||
} => write!(
|
||||
f,
|
||||
"Set flags for {} message{}: {:?}",
|
||||
env_hashes.len(),
|
||||
if env_hashes.len() == 1 { "" } else { "s" },
|
||||
flags
|
||||
),
|
||||
Self::SaveMessage { .. } => write!(f, "Save message"),
|
||||
Self::DeleteMessages { env_hashes, .. } => write!(
|
||||
f,
|
||||
"Delete {} message{}",
|
||||
env_hashes.len(),
|
||||
if env_hashes.len() == 1 { "" } else { "s" }
|
||||
),
|
||||
Self::CreateMailbox { path, .. } => write!(f, "Create mailbox {}", path),
|
||||
Self::DeleteMailbox { .. } => write!(f, "Delete mailbox"),
|
||||
//JobRequest::RenameMailbox,
|
||||
Self::SetMailboxPermissions { .. } => write!(f, "Set mailbox permissions"),
|
||||
Self::SetMailboxSubscription { .. } => write!(f, "Set mailbox subscription"),
|
||||
Self::Watch { .. } => write!(f, "Background watch"),
|
||||
Self::SendMessageBackground { .. } | Self::SendMessage => {
|
||||
write!(f, "Sending message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl JobRequest {
|
||||
is_variant! { is_watch, Watch { .. } }
|
||||
is_variant! { is_online, IsOnline { .. } }
|
||||
|
||||
pub fn is_fetch(&self, mailbox_hash: MailboxHash) -> bool {
|
||||
matches!(self, Self::Fetch {
|
||||
mailbox_hash: h, ..
|
||||
} if *h == mailbox_hash)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,347 @@
|
|||
//
|
||||
// meli - accounts module.
|
||||
//
|
||||
// Copyright 2017 Emmanouil Pitsidianakis <manos@pitsidianak.is>
|
||||
//
|
||||
// This file is part of meli.
|
||||
//
|
||||
// meli is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// meli is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// SPDX-License-Identifier: EUPL-1.2 OR GPL-3.0-or-later
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use melib::{
|
||||
backends::{Mailbox, MailboxHash},
|
||||
error::Error,
|
||||
log,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::{conf::FileMailboxConf, is_variant};
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub enum MailboxStatus {
|
||||
Available,
|
||||
Failed(Error),
|
||||
/// first argument is done work, and second is total work
|
||||
Parsing(usize, usize),
|
||||
#[default]
|
||||
None,
|
||||
}
|
||||
|
||||
impl MailboxStatus {
|
||||
is_variant! { is_available, Available }
|
||||
is_variant! { is_parsing, Parsing(_, _) }
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MailboxEntry {
|
||||
pub status: MailboxStatus,
|
||||
pub name: String,
|
||||
pub path: String,
|
||||
pub ref_mailbox: Mailbox,
|
||||
pub conf: FileMailboxConf,
|
||||
}
|
||||
|
||||
impl MailboxEntry {
|
||||
pub fn new(
|
||||
status: MailboxStatus,
|
||||
name: String,
|
||||
ref_mailbox: Mailbox,
|
||||
conf: FileMailboxConf,
|
||||
) -> Self {
|
||||
let mut ret = Self {
|
||||
status,
|
||||
name,
|
||||
path: ref_mailbox.path().into(),
|
||||
ref_mailbox,
|
||||
conf,
|
||||
};
|
||||
match ret.conf.mailbox_conf.extra.get("encoding") {
|
||||
None => {}
|
||||
Some(v) if ["utf-8", "utf8"].iter().any(|e| v.eq_ignore_ascii_case(e)) => {}
|
||||
Some(v) if ["utf-7", "utf7"].iter().any(|e| v.eq_ignore_ascii_case(e)) => {
|
||||
ret.name = melib::backends::utf7::decode_utf7_imap(&ret.name);
|
||||
ret.path = melib::backends::utf7::decode_utf7_imap(&ret.path);
|
||||
}
|
||||
Some(other) => {
|
||||
log::warn!(
|
||||
"mailbox `{}`: unrecognized mailbox name charset: {}",
|
||||
&ret.name,
|
||||
other
|
||||
);
|
||||
}
|
||||
}
|
||||
ret
|
||||
}
|
||||
|
||||
pub fn status(&self) -> String {
|
||||
match self.status {
|
||||
MailboxStatus::Available => format!(
|
||||
"{} [{} messages]",
|
||||
self.name(),
|
||||
self.ref_mailbox.count().ok().unwrap_or((0, 0)).1
|
||||
),
|
||||
MailboxStatus::Failed(ref e) => e.to_string(),
|
||||
MailboxStatus::None => "Retrieving mailbox.".to_string(),
|
||||
MailboxStatus::Parsing(done, total) => {
|
||||
format!("Parsing messages. [{}/{}]", done, total)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> &str {
|
||||
if let Some(name) = self.conf.mailbox_conf.alias.as_ref() {
|
||||
name
|
||||
} else {
|
||||
self.ref_mailbox.name()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize)]
|
||||
pub struct MailboxNode {
|
||||
pub hash: MailboxHash,
|
||||
pub depth: usize,
|
||||
pub indentation: u32,
|
||||
pub has_sibling: bool,
|
||||
pub children: Vec<MailboxNode>,
|
||||
}
|
||||
|
||||
pub fn build_mailboxes_order(
|
||||
tree: &mut Vec<MailboxNode>,
|
||||
mailbox_entries: &IndexMap<MailboxHash, MailboxEntry>,
|
||||
mailboxes_order: &mut Vec<MailboxHash>,
|
||||
) {
|
||||
tree.clear();
|
||||
mailboxes_order.clear();
|
||||
for (h, f) in mailbox_entries.iter() {
|
||||
if f.ref_mailbox.parent().is_none() {
|
||||
fn rec(
|
||||
h: MailboxHash,
|
||||
mailbox_entries: &IndexMap<MailboxHash, MailboxEntry>,
|
||||
depth: usize,
|
||||
) -> MailboxNode {
|
||||
let mut node = MailboxNode {
|
||||
hash: h,
|
||||
children: Vec::new(),
|
||||
depth,
|
||||
indentation: 0,
|
||||
has_sibling: false,
|
||||
};
|
||||
for &c in mailbox_entries[&h].ref_mailbox.children() {
|
||||
if mailbox_entries.contains_key(&c) {
|
||||
node.children.push(rec(c, mailbox_entries, depth + 1));
|
||||
}
|
||||
}
|
||||
node
|
||||
}
|
||||
|
||||
tree.push(rec(*h, mailbox_entries, 0));
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! mailbox_eq_key {
|
||||
($mailbox:expr) => {{
|
||||
if let Some(sort_order) = $mailbox.conf.mailbox_conf.sort_order {
|
||||
(0, sort_order, $mailbox.ref_mailbox.path())
|
||||
} else {
|
||||
(1, 0, $mailbox.ref_mailbox.path())
|
||||
}
|
||||
}};
|
||||
}
|
||||
tree.sort_unstable_by(|a, b| {
|
||||
if mailbox_entries[&b.hash]
|
||||
.conf
|
||||
.mailbox_conf
|
||||
.sort_order
|
||||
.is_none()
|
||||
&& mailbox_entries[&b.hash]
|
||||
.ref_mailbox
|
||||
.path()
|
||||
.eq_ignore_ascii_case("INBOX")
|
||||
{
|
||||
std::cmp::Ordering::Greater
|
||||
} else if mailbox_entries[&a.hash]
|
||||
.conf
|
||||
.mailbox_conf
|
||||
.sort_order
|
||||
.is_none()
|
||||
&& mailbox_entries[&a.hash]
|
||||
.ref_mailbox
|
||||
.path()
|
||||
.eq_ignore_ascii_case("INBOX")
|
||||
{
|
||||
std::cmp::Ordering::Less
|
||||
} else {
|
||||
mailbox_eq_key!(mailbox_entries[&a.hash])
|
||||
.cmp(&mailbox_eq_key!(mailbox_entries[&b.hash]))
|
||||
}
|
||||
});
|
||||
|
||||
let mut stack: SmallVec<[Option<&MailboxNode>; 16]> = SmallVec::new();
|
||||
for n in tree.iter_mut() {
|
||||
mailboxes_order.push(n.hash);
|
||||
n.children.sort_unstable_by(|a, b| {
|
||||
if mailbox_entries[&b.hash]
|
||||
.conf
|
||||
.mailbox_conf
|
||||
.sort_order
|
||||
.is_none()
|
||||
&& mailbox_entries[&b.hash]
|
||||
.ref_mailbox
|
||||
.path()
|
||||
.eq_ignore_ascii_case("INBOX")
|
||||
{
|
||||
std::cmp::Ordering::Greater
|
||||
} else if mailbox_entries[&a.hash]
|
||||
.conf
|
||||
.mailbox_conf
|
||||
.sort_order
|
||||
.is_none()
|
||||
&& mailbox_entries[&a.hash]
|
||||
.ref_mailbox
|
||||
.path()
|
||||
.eq_ignore_ascii_case("INBOX")
|
||||
{
|
||||
std::cmp::Ordering::Less
|
||||
} else {
|
||||
mailbox_eq_key!(mailbox_entries[&a.hash])
|
||||
.cmp(&mailbox_eq_key!(mailbox_entries[&b.hash]))
|
||||
}
|
||||
});
|
||||
stack.extend(n.children.iter().rev().map(Some));
|
||||
while let Some(Some(next)) = stack.pop() {
|
||||
mailboxes_order.push(next.hash);
|
||||
stack.extend(next.children.iter().rev().map(Some));
|
||||
}
|
||||
}
|
||||
drop(stack);
|
||||
for node in tree.iter_mut() {
|
||||
fn rec(
|
||||
node: &mut MailboxNode,
|
||||
mailbox_entries: &IndexMap<MailboxHash, MailboxEntry>,
|
||||
mut indentation: u32,
|
||||
has_sibling: bool,
|
||||
) {
|
||||
node.indentation = indentation;
|
||||
node.has_sibling = has_sibling;
|
||||
let mut iter = (0..node.children.len())
|
||||
.filter(|i| {
|
||||
mailbox_entries[&node.children[*i].hash]
|
||||
.ref_mailbox
|
||||
.is_subscribed()
|
||||
})
|
||||
.collect::<SmallVec<[_; 8]>>()
|
||||
.into_iter()
|
||||
.peekable();
|
||||
indentation <<= 1;
|
||||
if has_sibling {
|
||||
indentation |= 1;
|
||||
}
|
||||
while let Some(i) = iter.next() {
|
||||
let c = &mut node.children[i];
|
||||
rec(c, mailbox_entries, indentation, iter.peek().is_some());
|
||||
}
|
||||
}
|
||||
|
||||
rec(node, mailbox_entries, 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use melib::{
|
||||
backends::{Mailbox, MailboxHash},
|
||||
error::Result,
|
||||
MailboxPermissions, SpecialUsageMailbox,
|
||||
};
|
||||
|
||||
use crate::accounts::{FileMailboxConf, MailboxEntry, MailboxStatus};
|
||||
|
||||
#[test]
|
||||
fn test_mailbox_utf7() {
|
||||
#[derive(Debug)]
|
||||
struct TestMailbox(String);
|
||||
|
||||
impl melib::BackendMailbox for TestMailbox {
|
||||
fn hash(&self) -> MailboxHash {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
|
||||
fn path(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
|
||||
fn children(&self) -> &[MailboxHash] {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn clone(&self) -> Mailbox {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn special_usage(&self) -> SpecialUsageMailbox {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn parent(&self) -> Option<MailboxHash> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn permissions(&self) -> MailboxPermissions {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn is_subscribed(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_is_subscribed(&mut self, _: bool) -> Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_special_usage(&mut self, _: SpecialUsageMailbox) -> Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn count(&self) -> Result<(usize, usize)> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
for (n, d) in [
|
||||
("~peter/mail/&U,BTFw-/&ZeVnLIqe-", "~peter/mail/å°å/ę„ę¬čŖ"),
|
||||
("&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-", "ŠŃŠæŃŠ°Š²Š»ŠµŠ½Š½ŃŠµ"),
|
||||
] {
|
||||
let ref_mbox = TestMailbox(n.to_string());
|
||||
let mut conf: melib::MailboxConf = Default::default();
|
||||
conf.extra.insert("encoding".to_string(), "utf7".into());
|
||||
|
||||
let entry = MailboxEntry::new(
|
||||
MailboxStatus::None,
|
||||
n.to_string(),
|
||||
Box::new(ref_mbox),
|
||||
FileMailboxConf {
|
||||
mailbox_conf: conf,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
assert_eq!(&entry.path, d);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,8 +40,11 @@ pub enum SubCommand {
|
|||
PrintDefaultTheme,
|
||||
/// print loaded themes in full to stdout and exit.
|
||||
PrintLoadedThemes,
|
||||
/// print all paths that meli creates/uses.
|
||||
PrintUsedPaths,
|
||||
/// print all directories that meli creates/uses.
|
||||
PrintAppDirectories,
|
||||
/// print location of configuration file that will be loaded on normal app
|
||||
/// startup.
|
||||
PrintConfigPath,
|
||||
/// edit configuration files with `$EDITOR`/`$VISUAL`.
|
||||
EditConfig,
|
||||
/// create a sample configuration file with available configuration options.
|
||||
|
@ -71,8 +74,10 @@ pub enum SubCommand {
|
|||
destination_path: Option<PathBuf>,
|
||||
},
|
||||
#[structopt(display_order = 5)]
|
||||
/// print compile time feature flags of this binary
|
||||
/// Print compile time feature flags of this binary
|
||||
CompiledWith,
|
||||
/// Print log file location.
|
||||
PrintLogPath,
|
||||
/// View mail from input file.
|
||||
View {
|
||||
#[structopt(value_name = "INPUT", parse(from_os_str))]
|
||||
|
@ -82,12 +87,16 @@ pub enum SubCommand {
|
|||
|
||||
#[derive(Debug, StructOpt)]
|
||||
pub struct ManOpt {
|
||||
#[structopt(default_value = "meli", possible_values=&["meli", "conf", "themes", "meli.7", "guide"], value_name="PAGE", parse(try_from_str = manpages::parse_manpage))]
|
||||
#[cfg(feature = "cli-docs")]
|
||||
#[cfg_attr(feature = "cli-docs", structopt(default_value = "meli", possible_values=manpages::POSSIBLE_VALUES, value_name="PAGE", parse(try_from_str = manpages::parse_manpage)))]
|
||||
/// Name of manual page.
|
||||
pub page: manpages::ManPages,
|
||||
/// If true, output text in stdout instead of spawning $PAGER.
|
||||
#[structopt(long = "no-raw", alias = "no-raw", value_name = "bool")]
|
||||
#[cfg(feature = "cli-docs")]
|
||||
#[cfg_attr(
|
||||
feature = "cli-docs",
|
||||
structopt(long = "no-raw", alias = "no-raw", value_name = "bool")
|
||||
)]
|
||||
pub no_raw: Option<Option<bool>>,
|
||||
}
|
||||
|
||||
|
@ -103,6 +112,19 @@ pub mod manpages {
|
|||
|
||||
use crate::{Error, Result};
|
||||
|
||||
pub const POSSIBLE_VALUES: &[&str] = &[
|
||||
"meli",
|
||||
"meli.1",
|
||||
"conf",
|
||||
"meli.conf",
|
||||
"meli.conf.5",
|
||||
"themes",
|
||||
"meli-themes",
|
||||
"meli-themes.5",
|
||||
"guide",
|
||||
"meli.7",
|
||||
];
|
||||
|
||||
pub fn parse_manpage(src: &str) -> Result<ManPages> {
|
||||
match src {
|
||||
"" | "meli" | "meli.1" | "main" => Ok(ManPages::Main),
|
||||
|
@ -115,7 +137,7 @@ pub mod manpages {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
/// Choose manpage
|
||||
pub enum ManPages {
|
||||
/// meli(1)
|
||||
|
@ -171,7 +193,7 @@ pub mod manpages {
|
|||
.or_else(|| {
|
||||
#[allow(deprecated)]
|
||||
env::home_dir()
|
||||
.map(|p| p.join("local").join("share"))
|
||||
.map(|p| p.join(".local").join("share").join("man"))
|
||||
.filter(|p| path_valid(p, &mut tries))
|
||||
})
|
||||
else {
|
||||
|
@ -179,10 +201,10 @@ pub mod manpages {
|
|||
};
|
||||
|
||||
for (p, dir) in [
|
||||
(ManPages::Main, "man1"),
|
||||
(ManPages::Conf, "man5"),
|
||||
(ManPages::Themes, "man5"),
|
||||
(ManPages::Guide, "man7"),
|
||||
(Self::Main, "man1"),
|
||||
(Self::Conf, "man5"),
|
||||
(Self::Themes, "man5"),
|
||||
(Self::Guide, "man7"),
|
||||
] {
|
||||
let text = crate::subcommands::man(p, true)?;
|
||||
path.push(dir);
|
||||
|
|
|
@ -55,14 +55,15 @@ pub use crate::actions::{
|
|||
AccountAction::{self, *},
|
||||
Action::{self, *},
|
||||
ComposeAction::{self, *},
|
||||
FlagAction,
|
||||
ListingAction::{self, *},
|
||||
MailingListAction::{self, *},
|
||||
TabAction::{self, *},
|
||||
TagAction::{self, *},
|
||||
TagAction,
|
||||
ViewAction::{self, *},
|
||||
};
|
||||
|
||||
/// Helper macro to convert an array of tokens into a TokenStream
|
||||
/// Helper macro to convert an array of tokens into a `TokenStream`
|
||||
macro_rules! to_stream {
|
||||
($token: expr) => {
|
||||
TokenStream {
|
||||
|
@ -111,7 +112,7 @@ pub fn quoted_argument(input: &[u8]) -> IResult<&[u8], &str> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct TokenStream {
|
||||
tokens: &'static [TokenAdicity],
|
||||
}
|
||||
|
@ -225,7 +226,7 @@ impl TokenStream {
|
|||
|
||||
/// `Token` wrapper that defines how many times a token is expected to be
|
||||
/// repeated
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum TokenAdicity {
|
||||
ZeroOrOne(Token),
|
||||
ZeroOrMore(Token),
|
||||
|
@ -245,7 +246,7 @@ impl TokenAdicity {
|
|||
}
|
||||
|
||||
/// A token encountered in the UI's command execution bar
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum Token {
|
||||
Literal(&'static str),
|
||||
Filepath,
|
||||
|
@ -339,6 +340,11 @@ define_commands!([
|
|||
tokens: &[One(Literal("search")), One(RestOfStringValue)],
|
||||
parser: parser::search
|
||||
},
|
||||
{ tags: ["clear-selection"],
|
||||
desc: "clear-selection",
|
||||
tokens: &[One(Literal("clear-selection"))],
|
||||
parser: parser::select
|
||||
},
|
||||
{ tags: ["select"],
|
||||
desc: "select <TERM>, selects envelopes matching with given term",
|
||||
tokens: &[One(Literal("select")), One(RestOfStringValue)],
|
||||
|
@ -502,7 +508,7 @@ Alternatives(&[to_stream!(One(Literal("add-attachment")), One(Filepath)), to_str
|
|||
/// Get command suggestions for input
|
||||
pub fn command_completion_suggestions(input: &str) -> Vec<String> {
|
||||
use crate::melib::ShellExpandTrait;
|
||||
let mut sugg = Default::default();
|
||||
let mut sugg: HashSet<String> = Default::default();
|
||||
for (_tags, _desc, tokens, _) in COMMAND_COMPLETION.iter() {
|
||||
let _m = tokens.matches(&mut &(*input), &mut sugg);
|
||||
if _m.is_empty() {
|
||||
|
@ -527,17 +533,15 @@ mod tests {
|
|||
let mut input = "sort".to_string();
|
||||
macro_rules! match_input {
|
||||
($input:expr) => {{
|
||||
let mut sugg = Default::default();
|
||||
let mut vec = vec![];
|
||||
let mut sugg: HashSet<String> = Default::default();
|
||||
//print!("{}", $input);
|
||||
for (_tags, _desc, tokens, _) in COMMAND_COMPLETION.iter() {
|
||||
//println!("{:?}, {:?}, {:?}", _tags, _desc, tokens);
|
||||
let m = tokens.matches(&mut $input.as_str(), &mut sugg);
|
||||
if !m.is_empty() {
|
||||
vec.push(tokens);
|
||||
//print!("{:?} ", desc);
|
||||
//println!(" result = {:#?}\n\n", m);
|
||||
}
|
||||
// //println!("{:?}, {:?}, {:?}", _tags, _desc, tokens);
|
||||
let _ = tokens.matches(&mut $input.as_str(), &mut sugg);
|
||||
// if !m.is_empty() {
|
||||
// //print!("{:?} ", desc);
|
||||
// //println!(" result = {:#?}\n\n", m);
|
||||
// }
|
||||
}
|
||||
//println!("suggestions = {:#?}", sugg);
|
||||
sugg.into_iter()
|
||||
|
@ -586,7 +590,7 @@ mod tests {
|
|||
match io::stdin().read_line(&mut input) {
|
||||
Ok(_n) => {
|
||||
println!("Input is {:?}", input.as_str().trim());
|
||||
let mut sugg = Default::default();
|
||||
let mut sugg: HashSet<String> = Default::default();
|
||||
let mut vec = vec![];
|
||||
//print!("{}", input);
|
||||
for (_tags, _desc, tokens, _) in COMMAND_COMPLETION.iter() {
|
||||
|
|
|
@ -23,10 +23,16 @@
|
|||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use melib::{email::mailto::Mailto, SortField, SortOrder};
|
||||
use melib::{email::mailto::Mailto, Flag, SortField, SortOrder};
|
||||
|
||||
use crate::components::{Component, ComponentId};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum FlagAction {
|
||||
Set(Flag),
|
||||
Unset(Flag),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum TagAction {
|
||||
Add(String),
|
||||
|
@ -52,6 +58,8 @@ pub enum ListingAction {
|
|||
Delete,
|
||||
OpenInNewTab,
|
||||
Tag(TagAction),
|
||||
Flag(FlagAction),
|
||||
ClearSelection,
|
||||
ToggleThreadSnooze,
|
||||
}
|
||||
|
||||
|
@ -136,10 +144,10 @@ impl Action {
|
|||
pub fn needs_confirmation(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Action::Listing(ListingAction::Delete)
|
||||
| Action::MailingListAction(_)
|
||||
| Action::Mailbox(_, _)
|
||||
| Action::Quit
|
||||
Self::Listing(ListingAction::Delete)
|
||||
| Self::MailingListAction(_)
|
||||
| Self::Mailbox(_, _)
|
||||
| Self::Quit
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,9 +47,9 @@ impl<const MIN: u8, const MAX: u8> ArgCheck<MIN, MAX> {
|
|||
}
|
||||
);
|
||||
};
|
||||
let is_empty = dbg!(input.trim().is_empty());
|
||||
if is_empty && dbg!(MIN) > 0 {
|
||||
return dbg!(Err(CommandError::WrongNumberOfArguments {
|
||||
let is_empty = input.trim().is_empty();
|
||||
if is_empty && MIN > 0 {
|
||||
return Err(CommandError::WrongNumberOfArguments {
|
||||
too_many: false,
|
||||
takes: (MIN, MAX.into()),
|
||||
given: 0,
|
||||
|
@ -60,7 +60,7 @@ impl<const MIN: u8, const MAX: u8> ArgCheck<MIN, MAX> {
|
|||
MIN
|
||||
)
|
||||
.into(),
|
||||
}));
|
||||
});
|
||||
}
|
||||
*self = Self::BeforeArgument {
|
||||
so_far: 0,
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum CommandError {
|
||||
Parsing {
|
||||
inner: Cow<'static, str>,
|
||||
|
|
|
@ -101,6 +101,7 @@ pub fn listing_action(input: &[u8]) -> IResult<&[u8], Result<Action, CommandErro
|
|||
open_in_new_tab,
|
||||
export_mbox,
|
||||
_tag,
|
||||
flag,
|
||||
))(input)
|
||||
}
|
||||
|
||||
|
@ -154,6 +155,133 @@ pub fn parse_command(input: &[u8]) -> Result<Action, CommandError> {
|
|||
.and_then(|(_, v)| v)
|
||||
}
|
||||
|
||||
/// Set/unset a flag.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// # use meli::{melib::Flag, command::{Action,ListingAction, FlagAction, parser}};
|
||||
///
|
||||
/// let (rest, parsed) = parser::flag(b"flag set junk").unwrap();
|
||||
/// assert_eq!(rest, b"");
|
||||
/// assert!(
|
||||
/// matches!(
|
||||
/// parsed,
|
||||
/// Ok(Action::Listing(ListingAction::Flag(FlagAction::Set(
|
||||
/// Flag::TRASHED
|
||||
/// ))))
|
||||
/// ),
|
||||
/// "{:?}",
|
||||
/// parsed
|
||||
/// );
|
||||
///
|
||||
/// let (rest, parsed) = parser::flag(b"flag unset junk").unwrap();
|
||||
/// assert_eq!(rest, b"");
|
||||
/// assert!(
|
||||
/// matches!(
|
||||
/// parsed,
|
||||
/// Ok(Action::Listing(ListingAction::Flag(FlagAction::Unset(
|
||||
/// Flag::TRASHED
|
||||
/// ))))
|
||||
/// ),
|
||||
/// "{:?}",
|
||||
/// parsed
|
||||
/// );
|
||||
///
|
||||
/// let (rest, parsed) = parser::flag(b"flag set draft").unwrap();
|
||||
/// assert_eq!(rest, b"");
|
||||
/// assert!(
|
||||
/// matches!(
|
||||
/// parsed,
|
||||
/// Ok(Action::Listing(ListingAction::Flag(FlagAction::Set(
|
||||
/// Flag::DRAFT
|
||||
/// ))))
|
||||
/// ),
|
||||
/// "{:?}",
|
||||
/// parsed
|
||||
/// );
|
||||
///
|
||||
/// let (rest, parsed) = parser::flag(b"flag set xunk").unwrap();
|
||||
/// assert_eq!(rest, b"");
|
||||
/// assert_eq!(
|
||||
/// &parsed.unwrap_err().to_string(),
|
||||
/// "Bad value/argument: xunk is not a valid flag name. Possible values are: passed, replied, \
|
||||
/// seen or read, junk or trash or trashed, draft and flagged."
|
||||
/// );
|
||||
/// ```
|
||||
pub fn flag<'a>(input: &'a [u8]) -> IResult<&'a [u8], Result<Action, CommandError>> {
|
||||
use melib::Flag;
|
||||
|
||||
fn parse_flag(s: &str) -> Option<Flag> {
|
||||
match s {
|
||||
o if o.eq_ignore_ascii_case("passed") => Some(Flag::PASSED),
|
||||
o if o.eq_ignore_ascii_case("replied") => Some(Flag::REPLIED),
|
||||
o if o.eq_ignore_ascii_case("seen") => Some(Flag::SEEN),
|
||||
o if o.eq_ignore_ascii_case("read") => Some(Flag::SEEN),
|
||||
o if o.eq_ignore_ascii_case("junk") => Some(Flag::TRASHED),
|
||||
o if o.eq_ignore_ascii_case("trash") => Some(Flag::TRASHED),
|
||||
o if o.eq_ignore_ascii_case("trashed") => Some(Flag::TRASHED),
|
||||
o if o.eq_ignore_ascii_case("draft") => Some(Flag::DRAFT),
|
||||
o if o.eq_ignore_ascii_case("flagged") => Some(Flag::FLAGGED),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
preceded(
|
||||
tag("flag"),
|
||||
alt((
|
||||
|input: &'a [u8]| -> IResult<&'a [u8], Result<Action, CommandError>> {
|
||||
let mut check = arg_init! { min_arg:2, max_arg: 2, flag};
|
||||
let (input, _) = tag("set")(input.trim())?;
|
||||
arg_chk!(start check, input);
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
arg_chk!(inc check, input);
|
||||
let (input, flag) = quoted_argument(input.trim())?;
|
||||
arg_chk!(finish check, input);
|
||||
let (input, _) = eof(input)?;
|
||||
let Some(flag) = parse_flag(flag) else {
|
||||
return Ok((
|
||||
b"",
|
||||
Err(CommandError::BadValue {
|
||||
inner: format!(
|
||||
"{flag} is not a valid flag name. Possible values are: passed, \
|
||||
replied, seen or read, junk or trash or trashed, draft and \
|
||||
flagged."
|
||||
)
|
||||
.into(),
|
||||
}),
|
||||
));
|
||||
};
|
||||
Ok((input, Ok(Listing(Flag(FlagAction::Set(flag))))))
|
||||
},
|
||||
|input: &'a [u8]| -> IResult<&'a [u8], Result<Action, CommandError>> {
|
||||
let mut check = arg_init! { min_arg:2, max_arg: 2, flag};
|
||||
let (input, _) = tag("unset")(input.trim())?;
|
||||
arg_chk!(start check, input);
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
arg_chk!(inc check, input);
|
||||
let (input, flag) = quoted_argument(input.trim())?;
|
||||
arg_chk!(finish check, input);
|
||||
let (input, _) = eof(input)?;
|
||||
let Some(flag) = parse_flag(flag) else {
|
||||
return Ok((
|
||||
b"",
|
||||
Err(CommandError::BadValue {
|
||||
inner: format!(
|
||||
"{flag} is not a valid flag name. Possible values are: passed, \
|
||||
replied, seen or read, junk or trash or trashed, draft and \
|
||||
flagged."
|
||||
)
|
||||
.into(),
|
||||
}),
|
||||
));
|
||||
};
|
||||
Ok((input, Ok(Listing(Flag(FlagAction::Unset(flag))))))
|
||||
},
|
||||
)),
|
||||
)(input.trim())
|
||||
}
|
||||
|
||||
pub fn set(input: &[u8]) -> IResult<&[u8], Result<Action, CommandError>> {
|
||||
fn toggle(input: &[u8]) -> IResult<&[u8], Result<Action, CommandError>> {
|
||||
let mut check = arg_init! { min_arg:1, max_arg: 1, set};
|
||||
|
@ -336,6 +464,26 @@ pub fn search(input: &[u8]) -> IResult<&[u8], Result<Action, CommandError>> {
|
|||
Ok((input, Ok(Listing(Search(String::from(string))))))
|
||||
}
|
||||
pub fn select(input: &[u8]) -> IResult<&[u8], Result<Action, CommandError>> {
|
||||
#[inline]
|
||||
fn clear_selection(input: &[u8]) -> Option<IResult<&[u8], Result<Action, CommandError>>> {
|
||||
if !input.trim().starts_with(b"clear-selection") {
|
||||
return None;
|
||||
}
|
||||
#[inline]
|
||||
fn inner(input: &[u8]) -> IResult<&[u8], Result<Action, CommandError>> {
|
||||
let mut check = arg_init! { min_arg:0, max_arg: 0, clear_selection};
|
||||
let (input, _) = tag("clear-selection")(input.ltrim())?;
|
||||
arg_chk!(start check, input);
|
||||
arg_chk!(finish check, input);
|
||||
let (input, _) = eof(input)?;
|
||||
Ok((input, Ok(Listing(ListingAction::ClearSelection))))
|
||||
}
|
||||
Some(inner(input))
|
||||
}
|
||||
if let Some(retval) = clear_selection(input) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
let mut check = arg_init! { min_arg:1, max_arg: {u8::MAX}, select};
|
||||
let (input, _) = tag("select")(input.trim())?;
|
||||
arg_chk!(start check, input);
|
||||
|
@ -708,6 +856,19 @@ pub fn add_addresses_to_contacts(input: &[u8]) -> IResult<&[u8], Result<Action,
|
|||
let (input, _) = eof(input)?;
|
||||
Ok((input, Ok(View(AddAddressesToContacts))))
|
||||
}
|
||||
|
||||
/// Set/unset a tag.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// # use meli::command::{Action,ListingAction, TagAction, parser::_tag};
|
||||
///
|
||||
/// let (rest, parsed) = _tag(b"tag add newsletters").unwrap();
|
||||
/// println!("parsed is {:?}", parsed);
|
||||
/// assert_eq!(rest, b"");
|
||||
/// assert!(matches!(parsed, Ok(Action::Listing(ListingAction::Tag(TagAction::Add(ref tagname)))) if tagname == "newsletters"), "{:?}", parsed);
|
||||
/// ```
|
||||
pub fn _tag<'a>(input: &'a [u8]) -> IResult<&'a [u8], Result<Action, CommandError>> {
|
||||
preceded(
|
||||
tag("tag"),
|
||||
|
@ -721,7 +882,7 @@ pub fn _tag<'a>(input: &'a [u8]) -> IResult<&'a [u8], Result<Action, CommandErro
|
|||
let (input, tag) = quoted_argument(input.trim())?;
|
||||
arg_chk!(finish check, input);
|
||||
let (input, _) = eof(input)?;
|
||||
Ok((input, Ok(Listing(Tag(Add(tag.to_string()))))))
|
||||
Ok((input, Ok(Listing(Tag(TagAction::Add(tag.to_string()))))))
|
||||
},
|
||||
|input: &'a [u8]| -> IResult<&'a [u8], Result<Action, CommandError>> {
|
||||
let mut check = arg_init! { min_arg:2, max_arg: 2, tag};
|
||||
|
@ -732,11 +893,12 @@ pub fn _tag<'a>(input: &'a [u8]) -> IResult<&'a [u8], Result<Action, CommandErro
|
|||
let (input, tag) = quoted_argument(input.trim())?;
|
||||
arg_chk!(finish check, input);
|
||||
let (input, _) = eof(input)?;
|
||||
Ok((input, Ok(Listing(Tag(Remove(tag.to_string()))))))
|
||||
Ok((input, Ok(Listing(Tag(TagAction::Remove(tag.to_string()))))))
|
||||
},
|
||||
)),
|
||||
)(input.trim())
|
||||
}
|
||||
|
||||
pub fn print_account_setting(input: &[u8]) -> IResult<&[u8], Result<Action, CommandError>> {
|
||||
let mut check = arg_init! { min_arg:2, max_arg: 2, print};
|
||||
let (input, _) = tag("print")(input.trim())?;
|
||||
|
|
|
@ -31,7 +31,7 @@ use uuid::Uuid;
|
|||
|
||||
use super::*;
|
||||
|
||||
#[derive(Clone, Copy, Eq, Deserialize, Hash, Ord, PartialOrd, PartialEq, Serialize)]
|
||||
#[derive(Clone, Copy, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
||||
#[repr(transparent)]
|
||||
pub struct ComponentId(Uuid);
|
||||
|
||||
|
@ -98,7 +98,7 @@ impl ExtendShortcutsMaps for ShortcutMaps {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum PageMovement {
|
||||
Up(usize),
|
||||
Right(usize),
|
||||
|
@ -110,14 +110,14 @@ pub enum PageMovement {
|
|||
End,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct ScrollContext {
|
||||
pub shown_lines: usize,
|
||||
pub total_lines: usize,
|
||||
pub has_more_lines: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum ScrollUpdate {
|
||||
End(ComponentId),
|
||||
Update {
|
||||
|
@ -266,7 +266,7 @@ impl Default for ComponentAttr {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct ComponentPath {
|
||||
pub id: ComponentId,
|
||||
pub tail: SmallVec<[ComponentId; 8]>,
|
||||
|
|
171
meli/src/conf.rs
171
meli/src/conf.rs
|
@ -31,7 +31,11 @@ use std::{
|
|||
process::{Command, Stdio},
|
||||
};
|
||||
|
||||
use melib::{backends::TagHash, search::Query, SortField, SortOrder, StderrLogger};
|
||||
use melib::{
|
||||
backends::{MailboxHash, TagHash},
|
||||
search::Query,
|
||||
SortField, SortOrder, StderrLogger,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
conf::deserializers::non_empty_opt_string,
|
||||
|
@ -62,7 +66,7 @@ use std::{
|
|||
|
||||
use indexmap::IndexMap;
|
||||
use melib::{
|
||||
conf::{AccountSettings, MailboxConf, ToggleFlag},
|
||||
conf::{AccountSettings, ActionFlag, MailboxConf, ToggleFlag},
|
||||
error::*,
|
||||
};
|
||||
use pager::PagerSettings;
|
||||
|
@ -113,7 +117,7 @@ macro_rules! mailbox_settings {
|
|||
}};
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct MailUIConf {
|
||||
#[serde(default)]
|
||||
|
@ -136,7 +140,7 @@ pub struct MailUIConf {
|
|||
pub pgp: PGPSettingsOverride,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[serde(default)]
|
||||
pub struct FileMailboxConf {
|
||||
#[serde(flatten)]
|
||||
|
@ -158,14 +162,20 @@ impl FileMailboxConf {
|
|||
}
|
||||
|
||||
use crate::conf::deserializers::extra_settings;
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
pub struct FileAccount {
|
||||
pub root_mailbox: String,
|
||||
/// The mailbox that is the default to open / view for this account. Must be
|
||||
/// a valid mailbox path.
|
||||
///
|
||||
/// If not specified, the default is [`Self::root_mailbox`].
|
||||
#[serde(default = "none", skip_serializing_if = "Option::is_none")]
|
||||
pub default_mailbox: Option<String>,
|
||||
pub format: String,
|
||||
pub identity: String,
|
||||
#[serde(default)]
|
||||
pub extra_identities: Vec<String>,
|
||||
#[serde(default = "none")]
|
||||
#[serde(default = "none", skip_serializing_if = "Option::is_none")]
|
||||
pub display_name: Option<String>,
|
||||
|
||||
#[serde(default = "false_val")]
|
||||
|
@ -180,14 +190,18 @@ pub struct FileAccount {
|
|||
pub order: (SortField, SortOrder),
|
||||
#[serde(default = "false_val")]
|
||||
pub manual_refresh: bool,
|
||||
#[serde(default = "none")]
|
||||
#[serde(default = "none", skip_serializing_if = "Option::is_none")]
|
||||
pub refresh_command: Option<String>,
|
||||
#[serde(flatten)]
|
||||
pub conf_override: MailUIConf,
|
||||
#[serde(flatten)]
|
||||
#[serde(deserialize_with = "extra_settings")]
|
||||
pub extra: IndexMap<String, String>, /* use custom deserializer to convert any given value
|
||||
* (eg bool, number, etc) to string */
|
||||
#[serde(
|
||||
deserialize_with = "extra_settings",
|
||||
skip_serializing_if = "IndexMap::is_empty"
|
||||
)]
|
||||
/// Use custom deserializer to convert any given value (eg `bool`, number,
|
||||
/// etc) to `String`.
|
||||
pub extra: IndexMap<String, String>,
|
||||
}
|
||||
|
||||
impl FileAccount {
|
||||
|
@ -195,16 +209,12 @@ impl FileAccount {
|
|||
&self.mailboxes
|
||||
}
|
||||
|
||||
pub fn mailbox(&self) -> &str {
|
||||
&self.root_mailbox
|
||||
}
|
||||
|
||||
pub fn search_backend(&self) -> &SearchBackend {
|
||||
&self.search_backend
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct FileSettings {
|
||||
pub accounts: IndexMap<String, FileAccount>,
|
||||
|
@ -227,9 +237,11 @@ pub struct FileSettings {
|
|||
pub log: LogSettings,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize)]
|
||||
#[derive(Clone, Debug, Default, Serialize)]
|
||||
pub struct AccountConf {
|
||||
pub account: AccountSettings,
|
||||
pub default_mailbox: Option<MailboxHash>,
|
||||
pub sent_mailbox: Option<MailboxHash>,
|
||||
pub conf: FileAccount,
|
||||
pub conf_override: MailUIConf,
|
||||
pub mailbox_confs: IndexMap<String, FileMailboxConf>,
|
||||
|
@ -279,8 +291,10 @@ impl From<FileAccount> for AccountConf {
|
|||
};
|
||||
|
||||
let mailbox_confs = x.mailboxes.clone();
|
||||
AccountConf {
|
||||
Self {
|
||||
account: acc,
|
||||
default_mailbox: None,
|
||||
sent_mailbox: None,
|
||||
conf_override: x.conf_override.clone(),
|
||||
conf: x,
|
||||
mailbox_confs,
|
||||
|
@ -393,7 +407,7 @@ define(`include', `builtin_include(substr($1,1,decr(decr(len($1)))))dnl')dnl
|
|||
file.read_to_string(&mut contents)?;
|
||||
|
||||
let mut handle = Command::new("m4")
|
||||
.current_dir(conf_path.parent().unwrap_or(Path::new("/")))
|
||||
.current_dir(conf_path.parent().unwrap_or_else(|| Path::new("/")))
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
|
@ -407,7 +421,7 @@ define(`include', `builtin_include(substr($1,1,decr(decr(len($1)))))dnl')dnl
|
|||
}
|
||||
|
||||
impl FileSettings {
|
||||
pub fn new() -> Result<FileSettings> {
|
||||
pub fn new() -> Result<Self> {
|
||||
let config_path = get_config_file()?;
|
||||
if !config_path.exists() {
|
||||
let path_string = config_path.display().to_string();
|
||||
|
@ -429,28 +443,26 @@ impl FileSettings {
|
|||
));
|
||||
}
|
||||
#[cfg(test)]
|
||||
return Ok(FileSettings::default());
|
||||
return Ok(Self::default());
|
||||
#[cfg(not(test))]
|
||||
return Err(Error::new("No configuration file found."));
|
||||
}
|
||||
|
||||
FileSettings::validate(config_path, true, false)
|
||||
Self::validate(config_path, true, false)
|
||||
}
|
||||
|
||||
pub fn validate(path: PathBuf, interactive: bool, clear_extras: bool) -> Result<Self> {
|
||||
let s = pp::pp(&path)?;
|
||||
let map: toml::map::Map<String, toml::value::Value> =
|
||||
toml::from_str(&s).map_err(|err| {
|
||||
Error::new(format!(
|
||||
"{}:\nConfig file is invalid TOML: {}",
|
||||
path.display(),
|
||||
err
|
||||
))
|
||||
})?;
|
||||
/*
|
||||
* Check that a global composing option is set and return a user-friendly
|
||||
* error message because the default serde one is confusing.
|
||||
*/
|
||||
let map: toml::value::Table = toml::from_str(&s).map_err(|err| {
|
||||
Error::new(format!(
|
||||
"{}: Config file is invalid TOML; {}",
|
||||
path.display(),
|
||||
err
|
||||
))
|
||||
})?;
|
||||
|
||||
// Check that a global composing option is set and return a user-friendly
|
||||
// error message because the default serde one is confusing.
|
||||
if !map.contains_key("composing") {
|
||||
let err_msg = r#"You must set a global `composing` option. If you override `composing` in each account, you can use a dummy global like follows:
|
||||
|
||||
|
@ -469,11 +481,11 @@ This is required so that you don't accidentally start meli and find out later th
|
|||
};
|
||||
if ask.run() {
|
||||
let mut file = OpenOptions::new().append(true).open(&path)?;
|
||||
file.write_all("[composing]\nsend_mail = 'false'\n".as_bytes())
|
||||
file.write_all(b"[composing]\nsend_mail = 'false'\n")
|
||||
.map_err(|err| {
|
||||
Error::new(format!("Could not append to {}: {}", path.display(), err))
|
||||
})?;
|
||||
return FileSettings::validate(path, interactive, clear_extras);
|
||||
return Self::validate(path, interactive, clear_extras);
|
||||
}
|
||||
}
|
||||
return Err(Error::new(format!(
|
||||
|
@ -482,9 +494,9 @@ This is required so that you don't accidentally start meli and find out later th
|
|||
path.display()
|
||||
)));
|
||||
}
|
||||
let mut s: FileSettings = toml::from_str(&s).map_err(|err| {
|
||||
let mut s: Self = toml::from_str(&s).map_err(|err| {
|
||||
Error::new(format!(
|
||||
"{}:\nConfig file contains errors: {}",
|
||||
"{}: Config file contains errors; {}",
|
||||
path.display(),
|
||||
err
|
||||
))
|
||||
|
@ -534,6 +546,7 @@ This is required so that you don't accidentally start meli and find out later th
|
|||
mailboxes,
|
||||
extra,
|
||||
manual_refresh,
|
||||
default_mailbox: _,
|
||||
refresh_command: _,
|
||||
search_backend: _,
|
||||
conf_override: _,
|
||||
|
@ -557,6 +570,7 @@ This is required so that you don't accidentally start meli and find out later th
|
|||
.collect(),
|
||||
extra: extra.into_iter().collect(),
|
||||
};
|
||||
s.validate_config()?;
|
||||
backends.validate_config(&lowercase_format, &mut s)?;
|
||||
if !s.extra.is_empty() {
|
||||
return Err(Error::new(format!(
|
||||
|
@ -573,7 +587,7 @@ This is required so that you don't accidentally start meli and find out later th
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize)]
|
||||
#[derive(Clone, Debug, Default, Serialize)]
|
||||
pub struct Settings {
|
||||
pub accounts: IndexMap<String, AccountConf>,
|
||||
pub pager: PagerSettings,
|
||||
|
@ -586,11 +600,11 @@ pub struct Settings {
|
|||
pub terminal: TerminalSettings,
|
||||
pub log: LogSettings,
|
||||
#[serde(skip)]
|
||||
_logger: StderrLogger,
|
||||
pub _logger: StderrLogger,
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
pub fn new() -> Result<Settings> {
|
||||
pub fn new() -> Result<Self> {
|
||||
let fs = FileSettings::new()?;
|
||||
let mut s: IndexMap<String, AccountConf> = IndexMap::new();
|
||||
|
||||
|
@ -607,7 +621,7 @@ impl Settings {
|
|||
_logger.change_log_dest(log_path.into());
|
||||
}
|
||||
|
||||
Ok(Settings {
|
||||
Ok(Self {
|
||||
accounts: s,
|
||||
pager: fs.pager,
|
||||
listing: fs.listing,
|
||||
|
@ -622,7 +636,7 @@ impl Settings {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn without_accounts() -> Result<Settings> {
|
||||
pub fn without_accounts() -> Result<Self> {
|
||||
let fs = FileSettings::new()?;
|
||||
let mut _logger = StderrLogger::new(fs.log.maximum_level);
|
||||
|
||||
|
@ -630,7 +644,7 @@ impl Settings {
|
|||
_logger.change_log_dest(log_path.into());
|
||||
}
|
||||
|
||||
Ok(Settings {
|
||||
Ok(Self {
|
||||
accounts: IndexMap::new(),
|
||||
pager: fs.pager,
|
||||
listing: fs.listing,
|
||||
|
@ -646,7 +660,7 @@ impl Settings {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Debug, Clone, Hash, PartialEq, Eq, Default)]
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
|
||||
pub enum IndexStyle {
|
||||
Plain,
|
||||
Threaded,
|
||||
|
@ -680,16 +694,29 @@ mod default_vals {
|
|||
None
|
||||
}
|
||||
|
||||
pub(in crate::conf) fn internal_value_false<T: std::convert::From<super::ToggleFlag>>() -> T {
|
||||
super::ToggleFlag::InternalVal(false).into()
|
||||
pub(in crate::conf) fn internal_value_false<T: std::convert::From<melib::conf::ToggleFlag>>(
|
||||
) -> T {
|
||||
melib::conf::ToggleFlag::InternalVal(false).into()
|
||||
}
|
||||
|
||||
pub(in crate::conf) fn internal_value_true<T: std::convert::From<super::ToggleFlag>>() -> T {
|
||||
super::ToggleFlag::InternalVal(true).into()
|
||||
pub(in crate::conf) fn internal_value_true<T: std::convert::From<melib::conf::ToggleFlag>>() -> T
|
||||
{
|
||||
melib::conf::ToggleFlag::InternalVal(true).into()
|
||||
}
|
||||
|
||||
pub(in crate::conf) fn ask<T: std::convert::From<super::ToggleFlag>>() -> T {
|
||||
super::ToggleFlag::Ask.into()
|
||||
pub(in crate::conf) fn action_internal_value_false<T: std::convert::From<melib::ActionFlag>>(
|
||||
) -> T {
|
||||
melib::conf::ActionFlag::InternalVal(false).into()
|
||||
}
|
||||
|
||||
//pub(in crate::conf) fn action_internal_value_true<
|
||||
// T: std::convert::From<melib::conf::ActionFlag>,
|
||||
//>() -> T {
|
||||
// melib::conf::ActionFlag::InternalVal(true).into()
|
||||
//}
|
||||
|
||||
pub(in crate::conf) fn ask<T: std::convert::From<melib::conf::ActionFlag>>() -> T {
|
||||
melib::conf::ActionFlag::Ask.into()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -763,10 +790,10 @@ impl<'de> Deserialize<'de> for IndexStyle {
|
|||
{
|
||||
let s = <String>::deserialize(deserializer)?;
|
||||
match s.as_str() {
|
||||
"Plain" | "plain" => Ok(IndexStyle::Plain),
|
||||
"Threaded" | "threaded" => Ok(IndexStyle::Threaded),
|
||||
"Compact" | "compact" => Ok(IndexStyle::Compact),
|
||||
"Conversations" | "conversations" => Ok(IndexStyle::Conversations),
|
||||
"Plain" | "plain" => Ok(Self::Plain),
|
||||
"Threaded" | "threaded" => Ok(Self::Threaded),
|
||||
"Compact" | "compact" => Ok(Self::Compact),
|
||||
"Conversations" | "conversations" => Ok(Self::Conversations),
|
||||
_ => Err(de::Error::custom("invalid `index_style` value")),
|
||||
}
|
||||
}
|
||||
|
@ -778,15 +805,15 @@ impl Serialize for IndexStyle {
|
|||
S: Serializer,
|
||||
{
|
||||
match self {
|
||||
IndexStyle::Plain => serializer.serialize_str("plain"),
|
||||
IndexStyle::Threaded => serializer.serialize_str("threaded"),
|
||||
IndexStyle::Compact => serializer.serialize_str("compact"),
|
||||
IndexStyle::Conversations => serializer.serialize_str("conversations"),
|
||||
Self::Plain => serializer.serialize_str("plain"),
|
||||
Self::Threaded => serializer.serialize_str("threaded"),
|
||||
Self::Compact => serializer.serialize_str("compact"),
|
||||
Self::Conversations => serializer.serialize_str("conversations"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
|
||||
pub enum SearchBackend {
|
||||
None,
|
||||
#[default]
|
||||
|
@ -807,15 +834,15 @@ impl<'de> Deserialize<'de> for SearchBackend {
|
|||
if sqlite3.eq_ignore_ascii_case("sqlite3")
|
||||
|| sqlite3.eq_ignore_ascii_case("sqlite") =>
|
||||
{
|
||||
Ok(SearchBackend::Sqlite3)
|
||||
Ok(Self::Sqlite3)
|
||||
}
|
||||
none if none.eq_ignore_ascii_case("none")
|
||||
|| none.eq_ignore_ascii_case("nothing")
|
||||
|| none.is_empty() =>
|
||||
{
|
||||
Ok(SearchBackend::None)
|
||||
Ok(Self::None)
|
||||
}
|
||||
auto if auto.eq_ignore_ascii_case("auto") => Ok(SearchBackend::Auto),
|
||||
auto if auto.eq_ignore_ascii_case("auto") => Ok(Self::Auto),
|
||||
_ => Err(de::Error::custom("invalid `search_backend` value")),
|
||||
}
|
||||
}
|
||||
|
@ -828,9 +855,9 @@ impl Serialize for SearchBackend {
|
|||
{
|
||||
match self {
|
||||
#[cfg(feature = "sqlite3")]
|
||||
SearchBackend::Sqlite3 => serializer.serialize_str("sqlite3"),
|
||||
SearchBackend::None => serializer.serialize_str("none"),
|
||||
SearchBackend::Auto => serializer.serialize_str("auto"),
|
||||
Self::Sqlite3 => serializer.serialize_str("sqlite3"),
|
||||
Self::None => serializer.serialize_str("none"),
|
||||
Self::Auto => serializer.serialize_str("auto"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1001,7 +1028,7 @@ mod pp {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct LogSettings {
|
||||
#[serde(default)]
|
||||
|
@ -1042,6 +1069,7 @@ mod dotaddressable {
|
|||
impl DotAddressable for melib::LogLevel {}
|
||||
impl DotAddressable for PathBuf {}
|
||||
impl DotAddressable for ToggleFlag {}
|
||||
impl DotAddressable for ActionFlag {}
|
||||
impl DotAddressable for SearchBackend {}
|
||||
impl DotAddressable for melib::SpecialUsageMailbox {}
|
||||
impl<T: DotAddressable> DotAddressable for Option<T> {}
|
||||
|
@ -1263,7 +1291,7 @@ mod dotaddressable {
|
|||
|
||||
#[test]
|
||||
fn test_config_parse() {
|
||||
use std::{fmt::Write, fs, io::prelude::*, path::PathBuf};
|
||||
use std::{fmt::Write, fs, path::PathBuf};
|
||||
|
||||
struct ConfigFile {
|
||||
path: PathBuf,
|
||||
|
@ -1320,11 +1348,8 @@ send_mail = 'false'
|
|||
|
||||
impl ConfigFile {
|
||||
fn new(content: &str) -> std::result::Result<Self, std::io::Error> {
|
||||
let mut f = fs::File::open("/dev/urandom")?;
|
||||
let mut buf = [0u8; 16];
|
||||
f.read_exact(&mut buf)?;
|
||||
let mut filename = String::with_capacity(2 * 16);
|
||||
for byte in &buf {
|
||||
for byte in melib::utils::random::random_u64().to_be_bytes() {
|
||||
write!(&mut filename, "{:02X}", byte).unwrap();
|
||||
}
|
||||
let mut path = std::env::temp_dir();
|
||||
|
@ -1334,7 +1359,7 @@ send_mail = 'false'
|
|||
.append(true)
|
||||
.open(&path)?;
|
||||
file.write_all(content.as_bytes())?;
|
||||
Ok(ConfigFile { path, file })
|
||||
Ok(Self { path, file })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1352,7 +1377,7 @@ send_mail = 'false'
|
|||
));
|
||||
new_file
|
||||
.file
|
||||
.write_all("[composing]\nsend_mail = 'false'\n".as_bytes())
|
||||
.write_all(b"[composing]\nsend_mail = 'false'\n")
|
||||
.unwrap();
|
||||
let err = FileSettings::validate(new_file.path.clone(), false, true).unwrap_err();
|
||||
assert_eq!(
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
//! Configuration for composing email.
|
||||
use std::collections::HashMap;
|
||||
|
||||
use melib::{email::HeaderName, ToggleFlag};
|
||||
use melib::{conf::ActionFlag, email::HeaderName};
|
||||
use serde::{de, Deserialize, Deserializer};
|
||||
|
||||
use super::{
|
||||
default_vals::{ask, false_val, none, true_val},
|
||||
|
@ -30,7 +31,7 @@ use super::{
|
|||
};
|
||||
|
||||
/// Settings for writing and sending new e-mail
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct ComposingSettings {
|
||||
/// A command to pipe new emails to
|
||||
|
@ -46,9 +47,10 @@ pub struct ComposingSettings {
|
|||
alias = "editor_cmd"
|
||||
)]
|
||||
pub editor_command: Option<String>,
|
||||
/// Embed editor (for terminal interfaces) instead of forking and waiting.
|
||||
#[serde(default = "false_val")]
|
||||
pub embed: bool,
|
||||
/// Embedded editor (for terminal interfaces) instead of forking and
|
||||
/// waiting.
|
||||
#[serde(default = "false_val", alias = "embed")]
|
||||
pub embedded_pty: bool,
|
||||
/// Set "format=flowed" in plain text attachments.
|
||||
/// Default: true
|
||||
#[serde(default = "true_val", alias = "format-flowed")]
|
||||
|
@ -61,12 +63,12 @@ pub struct ComposingSettings {
|
|||
/// Default: empty
|
||||
#[serde(default, alias = "default-header-values")]
|
||||
pub default_header_values: HashMap<HeaderName, String>,
|
||||
/// Wrap header preample when editing a draft in an editor. This allows you
|
||||
/// Wrap header preamble when editing a draft in an editor. This allows you
|
||||
/// to write non-plain text email without the preamble creating syntax
|
||||
/// errors. They are stripped when you return from the editor. The
|
||||
/// values should be a two element array of strings, a prefix and suffix.
|
||||
/// Default: None
|
||||
#[serde(default, alias = "wrap-header-preample")]
|
||||
#[serde(default, alias = "wrap-header-preamble")]
|
||||
pub wrap_header_preamble: Option<(String, String)>,
|
||||
/// Store sent mail after successful submission. This setting is meant to be
|
||||
/// disabled for non-standard behaviour in gmail, which auto-saves sent
|
||||
|
@ -90,7 +92,7 @@ pub struct ComposingSettings {
|
|||
/// Forward emails as attachment? (Alternative is inline)
|
||||
/// Default: ask
|
||||
#[serde(default = "ask", alias = "forward-as-attachment")]
|
||||
pub forward_as_attachment: ToggleFlag,
|
||||
pub forward_as_attachment: ActionFlag,
|
||||
/// Alternative lists of reply prefixes (etc. ["Re:", "RE:", ...]) to strip
|
||||
/// Default: `["Re:", "RE:", "Fwd:", "Fw:", "åå¤:", "åč¦:", "SV:", "Sv:",
|
||||
/// "VS:", "Antw:", "Doorst:", "VS:", "VL:", "REF:", "TR:", "TR:", "AW:",
|
||||
|
@ -113,10 +115,10 @@ pub struct ComposingSettings {
|
|||
|
||||
impl Default for ComposingSettings {
|
||||
fn default() -> Self {
|
||||
ComposingSettings {
|
||||
Self {
|
||||
send_mail: SendMail::ShellCommand("false".into()),
|
||||
editor_command: None,
|
||||
embed: false,
|
||||
embedded_pty: false,
|
||||
format_flowed: true,
|
||||
insert_user_agent: true,
|
||||
default_header_values: HashMap::default(),
|
||||
|
@ -124,7 +126,7 @@ impl Default for ComposingSettings {
|
|||
wrap_header_preamble: None,
|
||||
attribution_format_string: None,
|
||||
attribution_use_posix_locale: true,
|
||||
forward_as_attachment: ToggleFlag::Ask,
|
||||
forward_as_attachment: ActionFlag::Ask,
|
||||
reply_prefix_list_to_strip: None,
|
||||
reply_prefix: res(),
|
||||
custom_compose_hooks: vec![],
|
||||
|
@ -175,7 +177,7 @@ pub mod strings {
|
|||
named_unit_variant!(server_submission);
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum SendMail {
|
||||
#[cfg(feature = "smtp")]
|
||||
|
@ -187,7 +189,7 @@ pub enum SendMail {
|
|||
|
||||
/// Shell command compose hooks (See
|
||||
/// [`crate::mail::compose::hooks::Hook`])
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct ComposeHook {
|
||||
#[serde(deserialize_with = "non_empty_string")]
|
||||
|
@ -201,3 +203,103 @@ impl From<ComposeHook> for crate::mail::hooks::Hook {
|
|||
Self::new_shell_command(c.name.into(), c.command)
|
||||
}
|
||||
}
|
||||
const SENDMAIL_ERR_HELP: &str = r#"Invalid `send_mail` value.
|
||||
|
||||
Here are some valid examples:
|
||||
|
||||
Use server submission in protocols that support it (JMAP, NNTP)
|
||||
===============================================================
|
||||
|
||||
send_mail = "server_submission"
|
||||
|
||||
Using a shell script
|
||||
====================
|
||||
|
||||
send_mail = "msmtp --read-recipients --read-envelope-from"
|
||||
|
||||
Direct SMTP connection
|
||||
======================
|
||||
|
||||
send_mail = { hostname = "mail.example.com", port = 587, auth = { type = "auto", password = { type = "raw", value = "hunter2" } }, security = { type = "STARTTLS" } }
|
||||
|
||||
[composing.send_mail]
|
||||
hostname = "mail.example.com"
|
||||
port = 587
|
||||
auth = { type = "auto", password = { type = "command_eval", value = "/path/to/password_script.sh" } }
|
||||
security = { type = "TLS", danger_accept_invalid_certs = true } }
|
||||
|
||||
|
||||
`send_mail` direct SMTP connection fields:
|
||||
- hostname: text
|
||||
- port: valid port number
|
||||
- envelope_from: text (optional, default is empty),
|
||||
- auth: ...
|
||||
- security: ... (optional, default is "auto")
|
||||
- extensions: ... (optional, default is PIPELINING, CHUNKING, PRDR, 8BITMIME, BINARYMIME, SMTPUTF8, AUTH and DSN_NOTIFY)
|
||||
|
||||
Possible values for `send_mail.auth`:
|
||||
|
||||
No authentication:
|
||||
|
||||
auth = { type = "none" }
|
||||
|
||||
Regular authentication:
|
||||
Note: `require_auth` and `auth_type` are optional and can be skipped.
|
||||
|
||||
auth = { type = "auto", username = "...", password = "...", require_auth = true, auth_type = ... }
|
||||
|
||||
password can be:
|
||||
password = { type = "raw", value = "..." }
|
||||
password = { type = "command_eval", value = "/path/to/password_script.sh" }
|
||||
|
||||
XOAuth2 authentication:
|
||||
Note: `require_auth` is optional and can be skipped.
|
||||
auth = { type = "xoauth2", token_command = "...", require_auth = true }
|
||||
|
||||
Possible values for `send_mail.auth.auth_type` when `auth.type` is "auto":
|
||||
|
||||
auth_type = { plain = false, login = true }
|
||||
|
||||
Possible values for `send_mail.security`:
|
||||
Note that in all cases field `danger_accept_invalid_certs` is optional and its default value is false.
|
||||
|
||||
security = "none"
|
||||
security = { type = "auto", danger_accept_invalid_certs = false }
|
||||
security = { type = "STARTTLS", danger_accept_invalid_certs = false }
|
||||
security = { type = "TLS", danger_accept_invalid_certs = false }
|
||||
|
||||
Possible values for `send_mail.extensions` (All optional and have default values `true`:
|
||||
pipelining
|
||||
chunking
|
||||
8bitmime
|
||||
prdr
|
||||
binarymime
|
||||
smtputf8
|
||||
auth
|
||||
dsn_notify: Array of options e.g. ["FAILURE"]
|
||||
"#;
|
||||
|
||||
impl<'de> Deserialize<'de> for SendMail {
|
||||
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
#[derive(Deserialize)]
|
||||
#[serde(untagged)]
|
||||
enum SendMailInner {
|
||||
#[cfg(feature = "smtp")]
|
||||
Smtp(melib::smtp::SmtpServerConf),
|
||||
#[serde(with = "strings::server_submission")]
|
||||
ServerSubmission,
|
||||
ShellCommand(String),
|
||||
}
|
||||
|
||||
match <SendMailInner>::deserialize(deserializer) {
|
||||
#[cfg(feature = "smtp")]
|
||||
Ok(SendMailInner::Smtp(v)) => Ok(Self::Smtp(v)),
|
||||
Ok(SendMailInner::ServerSubmission) => Ok(Self::ServerSubmission),
|
||||
Ok(SendMailInner::ShellCommand(v)) => Ok(Self::ShellCommand(v)),
|
||||
Err(_err) => Err(de::Error::custom(SENDMAIL_ERR_HELP)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use melib::{search::Query, Error, Result};
|
||||
use melib::{search::Query, Error, Result, ToggleFlag};
|
||||
|
||||
use super::{default_vals::*, DotAddressable, IndexStyle};
|
||||
|
||||
|
@ -55,7 +55,7 @@ use super::{default_vals::*, DotAddressable, IndexStyle};
|
|||
/// const HAS_SIBLING_LEAF: &str = " āā";
|
||||
/// const NO_SIBLING_LEAF: &str = " ā°ā";
|
||||
/// ```
|
||||
#[derive(Debug, Deserialize, Clone, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct ListingSettings {
|
||||
/// Number of context lines when going to next page.
|
||||
|
@ -130,6 +130,17 @@ pub struct ListingSettings {
|
|||
#[serde(default)]
|
||||
pub attachment_flag: Option<String>,
|
||||
|
||||
/// Flag to show if any thread entry contains your address as a receiver.
|
||||
/// Useful to make mailing list threads that CC you stand out.
|
||||
/// Default: "āø"
|
||||
#[serde(default)]
|
||||
pub highlight_self_flag: Option<String>,
|
||||
|
||||
/// Show `highlight_self_flag` or not.
|
||||
/// Default: false
|
||||
#[serde(default)]
|
||||
pub highlight_self: ToggleFlag,
|
||||
|
||||
/// Should threads with different Subjects show a list of those
|
||||
/// subjects on the entry title?
|
||||
/// Default: "true"
|
||||
|
@ -185,6 +196,8 @@ impl Default for ListingSettings {
|
|||
thread_snoozed_flag: None,
|
||||
selected_flag: None,
|
||||
attachment_flag: None,
|
||||
highlight_self_flag: None,
|
||||
highlight_self: ToggleFlag::Unset,
|
||||
thread_subject_pack: true,
|
||||
threaded_repeat_identical_from_values: false,
|
||||
relative_menu_indices: true,
|
||||
|
@ -224,6 +237,8 @@ impl DotAddressable for ListingSettings {
|
|||
"thread_snoozed_flag" => self.thread_snoozed_flag.lookup(field, tail),
|
||||
"selected_flag" => self.selected_flag.lookup(field, tail),
|
||||
"attachment_flag" => self.attachment_flag.lookup(field, tail),
|
||||
"highlight_self_flag" => self.highlight_self_flag.lookup(field, tail),
|
||||
"highlight_self" => self.highlight_self.lookup(field, tail),
|
||||
"thread_subject_pack" => self.thread_subject_pack.lookup(field, tail),
|
||||
"threaded_repeat_identical_from_values" => self
|
||||
.threaded_repeat_identical_from_values
|
||||
|
|
|
@ -27,7 +27,7 @@ use super::{
|
|||
};
|
||||
|
||||
/// Settings for the notifications function.
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct NotificationsSettings {
|
||||
/// Enable notifications.
|
||||
|
|
|
@ -22,22 +22,22 @@
|
|||
|
||||
#![allow(clippy::derivable_impls)]
|
||||
|
||||
//! This module is automatically generated by config_macros.rs.
|
||||
//! This module is automatically generated by `config_macros.rs`.
|
||||
|
||||
use super::*;
|
||||
use melib::HeaderName;
|
||||
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct PagerSettingsOverride { # [doc = " Number of context lines when going to next page."] # [doc = " Default: 0"] # [serde (alias = "pager-context")] # [serde (default)] pub pager_context : Option < usize > , # [doc = " Stop at the end instead of displaying next mail."] # [doc = " Default: false"] # [serde (alias = "pager-stop")] # [serde (default)] pub pager_stop : Option < bool > , # [doc = " Always show headers when scrolling."] # [doc = " Default: true"] # [serde (alias = "sticky-headers" , alias = "headers-sticky" , alias = "headers_sticky")] # [serde (default)] pub sticky_headers : Option < bool > , # [doc = " The height of the pager in mail view, in percent."] # [doc = " Default: 80"] # [serde (alias = "pager-ratio")] # [serde (default)] pub pager_ratio : Option < usize > , # [doc = " A command to pipe mail output through for viewing in pager."] # [doc = " Default: None"] # [serde (deserialize_with = "non_empty_opt_string")] # [serde (default)] pub filter : Option < Option < String > > , # [doc = " A command to pipe html output before displaying it in a pager"] # [doc = " Default: None"] # [serde (deserialize_with = "non_empty_opt_string" , alias = "html-filter")] # [serde (default)] pub html_filter : Option < Option < String > > , # [doc = " Respect \"format=flowed\""] # [doc = " Default: true"] # [serde (alias = "format-flowed")] # [serde (default)] pub format_flowed : Option < bool > , # [doc = " Split long lines that would overflow on the x axis."] # [doc = " Default: true"] # [serde (alias = "split-long-lines")] # [serde (default)] pub split_long_lines : Option < bool > , # [doc = " Minimum text width in columns."] # [doc = " Default: 80"] # [serde (alias = "minimum-width")] # [serde (default)] pub minimum_width : Option < usize > , # [doc = " Choose `text/html` alternative if `text/plain` is empty in"] # [doc = " `multipart/alternative` attachments."] # [doc = " Default: true"] # [serde (alias = "auto-choose-multipart-alternative")] # [serde (default)] pub auto_choose_multipart_alternative : Option < ToggleFlag > , # [doc = " Show Date: in my timezone"] # [doc = " Default: true"] # [serde (alias = "show-date-in-my-timezone")] # [serde (default)] pub show_date_in_my_timezone : Option < ToggleFlag > , # [doc = " A command to launch URLs with. The URL will be given as the first"] # [doc = " argument of the command. Default: None"] # [serde (deserialize_with = "non_empty_opt_string")] # [serde (default)] pub url_launcher : Option < Option < String > > , # [doc = " A command to open html files."] # [doc = " Default: None"] # [serde (deserialize_with = "non_empty_opt_string" , alias = "html-open")] # [serde (default)] pub html_open : Option < Option < String > > , # [doc = " Extra headers to display, if present, in the default header preamble."] # [doc = " Default: []"] # [serde (alias = "show-extra-headers")] # [serde (default)] pub show_extra_headers : Option < Vec < String > > } impl Default for PagerSettingsOverride { fn default () -> Self { PagerSettingsOverride { pager_context : None , pager_stop : None , sticky_headers : None , pager_ratio : None , filter : None , html_filter : None , format_flowed : None , split_long_lines : None , minimum_width : None , auto_choose_multipart_alternative : None , show_date_in_my_timezone : None , url_launcher : None , html_open : None , show_extra_headers : None } } }
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct PagerSettingsOverride { # [doc = " Number of context lines when going to next page."] # [doc = " Default: 0"] # [serde (alias = "pager-context")] # [serde (default)] pub pager_context : Option < usize > , # [doc = " Stop at the end instead of displaying next mail."] # [doc = " Default: false"] # [serde (alias = "pager-stop")] # [serde (default)] pub pager_stop : Option < bool > , # [doc = " Always show headers when scrolling."] # [doc = " Default: true"] # [serde (alias = "sticky-headers" , alias = "headers-sticky" , alias = "headers_sticky")] # [serde (default)] pub sticky_headers : Option < bool > , # [doc = " The height of the pager in mail view, in percent."] # [doc = " Default: 80"] # [serde (alias = "pager-ratio")] # [serde (default)] pub pager_ratio : Option < usize > , # [doc = " A command to pipe mail output through for viewing in pager."] # [doc = " Default: None"] # [serde (deserialize_with = "non_empty_opt_string")] # [serde (default)] pub filter : Option < Option < String > > , # [doc = " A command to pipe html output before displaying it in a pager"] # [doc = " Default: None"] # [serde (deserialize_with = "non_empty_opt_string" , alias = "html-filter")] # [serde (default)] pub html_filter : Option < Option < String > > , # [doc = " Respect \"format=flowed\""] # [doc = " Default: true"] # [serde (alias = "format-flowed")] # [serde (default)] pub format_flowed : Option < bool > , # [doc = " Split long lines that would overflow on the x axis."] # [doc = " Default: true"] # [serde (alias = "split-long-lines")] # [serde (default)] pub split_long_lines : Option < bool > , # [doc = " Minimum text width in columns."] # [doc = " Default: 80"] # [serde (alias = "minimum-width")] # [serde (default)] pub minimum_width : Option < usize > , # [doc = " Choose `text/html` alternative if `text/plain` is empty in"] # [doc = " `multipart/alternative` attachments."] # [doc = " Default: true"] # [serde (alias = "auto-choose-multipart-alternative")] # [serde (default)] pub auto_choose_multipart_alternative : Option < ToggleFlag > , # [doc = " Show Date: in my timezone"] # [doc = " Default: true"] # [serde (alias = "show-date-in-my-timezone")] # [serde (default)] pub show_date_in_my_timezone : Option < ToggleFlag > , # [doc = " A command to launch URLs with. The URL will be given as the first"] # [doc = " argument of the command. Default: None"] # [serde (deserialize_with = "non_empty_opt_string")] # [serde (default)] pub url_launcher : Option < Option < String > > , # [doc = " A command to open html files."] # [doc = " Default: None"] # [serde (deserialize_with = "non_empty_opt_string" , alias = "html-open")] # [serde (default)] pub html_open : Option < Option < String > > , # [doc = " Extra headers to display, if present, in the default header preamble."] # [doc = " Default: []"] # [serde (alias = "show-extra-headers")] # [serde (default)] pub show_extra_headers : Option < Vec < String > > } impl Default for PagerSettingsOverride { fn default () -> Self { Self { pager_context : None , pager_stop : None , sticky_headers : None , pager_ratio : None , filter : None , html_filter : None , format_flowed : None , split_long_lines : None , minimum_width : None , auto_choose_multipart_alternative : None , show_date_in_my_timezone : None , url_launcher : None , html_open : None , show_extra_headers : None } } }
|
||||
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct ListingSettingsOverride { # [doc = " Number of context lines when going to next page."] # [doc = " Default: 0"] # [serde (alias = "context-lines")] # [serde (default)] pub context_lines : Option < usize > , # [doc = " Show auto-hiding scrollbar in accounts sidebar menu."] # [doc = " Default: True"] # [serde (default)] pub show_menu_scrollbar : Option < bool > , # [doc = " Datetime formatting passed verbatim to strftime(3)."] # [doc = " Default: %Y-%m-%d %T"] # [serde (alias = "datetime-fmt")] # [serde (default)] pub datetime_fmt : Option < Option < String > > , # [doc = " Show recent dates as `X {minutes,hours,days} ago`, up to 7 days."] # [doc = " Default: true"] # [serde (alias = "recent-dates")] # [serde (default)] pub recent_dates : Option < bool > , # [doc = " Show only envelopes that match this query"] # [doc = " Default: None"] # [serde (default)] pub filter : Option < Option < Query > > , # [serde (alias = "index-style")] # [serde (default)] pub index_style : Option < IndexStyle > , # [doc = " Default: \" \""] # [serde (default)] pub sidebar_mailbox_tree_has_sibling : Option < Option < String > > , # [doc = " Default: \" \""] # [serde (default)] pub sidebar_mailbox_tree_no_sibling : Option < Option < String > > , # [doc = " Default: \" \""] # [serde (default)] pub sidebar_mailbox_tree_has_sibling_leaf : Option < Option < String > > , # [doc = " Default: \" \""] # [serde (default)] pub sidebar_mailbox_tree_no_sibling_leaf : Option < Option < String > > , # [doc = " Default: ' '"] # [serde (default)] pub sidebar_divider : Option < char > , # [doc = " Default: 90"] # [serde (default)] pub sidebar_ratio : Option < usize > , # [doc = " Flag to show if thread entry contains unseen mail."] # [doc = " Default: \"ā\""] # [serde (default)] pub unseen_flag : Option < Option < String > > , # [doc = " Flag to show if thread has been snoozed."] # [doc = " Default: \"š¤\""] # [serde (default)] pub thread_snoozed_flag : Option < Option < String > > , # [doc = " Flag to show if thread entry has been selected."] # [doc = " Default: \"ā\u{fe0f}\""] # [serde (default)] pub selected_flag : Option < Option < String > > , # [doc = " Flag to show if thread entry contains attachments."] # [doc = " Default: \"š\""] # [serde (default)] pub attachment_flag : Option < Option < String > > , # [doc = " Should threads with different Subjects show a list of those"] # [doc = " subjects on the entry title?"] # [doc = " Default: \"true\""] # [serde (default)] pub thread_subject_pack : Option < bool > , # [doc = " In threaded listing style, repeat identical From column values within a"] # [doc = " thread. Not repeating adds empty space in the From column which"] # [doc = " might result in less visual clutter."] # [doc = " Default: \"false\""] # [serde (default)] pub threaded_repeat_identical_from_values : Option < bool > , # [doc = " Show relative indices in menu mailboxes to quickly help with jumping to"] # [doc = " them. Default: \"true\""] # [serde (alias = "relative-menu-indices")] # [serde (default)] pub relative_menu_indices : Option < bool > , # [doc = " Show relative indices in listings to quickly help with jumping to"] # [doc = " them. Default: \"true\""] # [serde (alias = "relative-list-indices")] # [serde (default)] pub relative_list_indices : Option < bool > , # [doc = " Hide sidebar on launch. Default: \"false\""] # [serde (alias = "hide-sidebar-on-launch")] # [serde (default)] pub hide_sidebar_on_launch : Option < bool > } impl Default for ListingSettingsOverride { fn default () -> Self { ListingSettingsOverride { context_lines : None , show_menu_scrollbar : None , datetime_fmt : None , recent_dates : None , filter : None , index_style : None , sidebar_mailbox_tree_has_sibling : None , sidebar_mailbox_tree_no_sibling : None , sidebar_mailbox_tree_has_sibling_leaf : None , sidebar_mailbox_tree_no_sibling_leaf : None , sidebar_divider : None , sidebar_ratio : None , unseen_flag : None , thread_snoozed_flag : None , selected_flag : None , attachment_flag : None , thread_subject_pack : None , threaded_repeat_identical_from_values : None , relative_menu_indices : None , relative_list_indices : None , hide_sidebar_on_launch : None } } }
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct ListingSettingsOverride { # [doc = " Number of context lines when going to next page."] # [doc = " Default: 0"] # [serde (alias = "context-lines")] # [serde (default)] pub context_lines : Option < usize > , # [doc = " Show auto-hiding scrollbar in accounts sidebar menu."] # [doc = " Default: True"] # [serde (default)] pub show_menu_scrollbar : Option < bool > , # [doc = " Datetime formatting passed verbatim to strftime(3)."] # [doc = " Default: %Y-%m-%d %T"] # [serde (alias = "datetime-fmt")] # [serde (default)] pub datetime_fmt : Option < Option < String > > , # [doc = " Show recent dates as `X {minutes,hours,days} ago`, up to 7 days."] # [doc = " Default: true"] # [serde (alias = "recent-dates")] # [serde (default)] pub recent_dates : Option < bool > , # [doc = " Show only envelopes that match this query"] # [doc = " Default: None"] # [serde (default)] pub filter : Option < Option < Query > > , # [serde (alias = "index-style")] # [serde (default)] pub index_style : Option < IndexStyle > , # [doc = " Default: \" \""] # [serde (default)] pub sidebar_mailbox_tree_has_sibling : Option < Option < String > > , # [doc = " Default: \" \""] # [serde (default)] pub sidebar_mailbox_tree_no_sibling : Option < Option < String > > , # [doc = " Default: \" \""] # [serde (default)] pub sidebar_mailbox_tree_has_sibling_leaf : Option < Option < String > > , # [doc = " Default: \" \""] # [serde (default)] pub sidebar_mailbox_tree_no_sibling_leaf : Option < Option < String > > , # [doc = " Default: ' '"] # [serde (default)] pub sidebar_divider : Option < char > , # [doc = " Default: 90"] # [serde (default)] pub sidebar_ratio : Option < usize > , # [doc = " Flag to show if thread entry contains unseen mail."] # [doc = " Default: \"ā\""] # [serde (default)] pub unseen_flag : Option < Option < String > > , # [doc = " Flag to show if thread has been snoozed."] # [doc = " Default: \"š¤\""] # [serde (default)] pub thread_snoozed_flag : Option < Option < String > > , # [doc = " Flag to show if thread entry has been selected."] # [doc = " Default: \"ā\u{fe0f}\""] # [serde (default)] pub selected_flag : Option < Option < String > > , # [doc = " Flag to show if thread entry contains attachments."] # [doc = " Default: \"š\""] # [serde (default)] pub attachment_flag : Option < Option < String > > , # [doc = " Flag to show if any thread entry contains your address as a receiver."] # [doc = " Useful to make mailing list threads that CC you stand out."] # [doc = " Default: \"āø\""] # [serde (default)] pub highlight_self_flag : Option < Option < String > > , # [doc = " Show `highlight_self_flag` or not."] # [doc = " Default: false"] # [serde (default)] pub highlight_self : Option < ToggleFlag > , # [doc = " Should threads with different Subjects show a list of those"] # [doc = " subjects on the entry title?"] # [doc = " Default: \"true\""] # [serde (default)] pub thread_subject_pack : Option < bool > , # [doc = " In threaded listing style, repeat identical From column values within a"] # [doc = " thread. Not repeating adds empty space in the From column which"] # [doc = " might result in less visual clutter."] # [doc = " Default: \"false\""] # [serde (default)] pub threaded_repeat_identical_from_values : Option < bool > , # [doc = " Show relative indices in menu mailboxes to quickly help with jumping to"] # [doc = " them. Default: \"true\""] # [serde (alias = "relative-menu-indices")] # [serde (default)] pub relative_menu_indices : Option < bool > , # [doc = " Show relative indices in listings to quickly help with jumping to"] # [doc = " them. Default: \"true\""] # [serde (alias = "relative-list-indices")] # [serde (default)] pub relative_list_indices : Option < bool > , # [doc = " Hide sidebar on launch. Default: \"false\""] # [serde (alias = "hide-sidebar-on-launch")] # [serde (default)] pub hide_sidebar_on_launch : Option < bool > } impl Default for ListingSettingsOverride { fn default () -> Self { Self { context_lines : None , show_menu_scrollbar : None , datetime_fmt : None , recent_dates : None , filter : None , index_style : None , sidebar_mailbox_tree_has_sibling : None , sidebar_mailbox_tree_no_sibling : None , sidebar_mailbox_tree_has_sibling_leaf : None , sidebar_mailbox_tree_no_sibling_leaf : None , sidebar_divider : None , sidebar_ratio : None , unseen_flag : None , thread_snoozed_flag : None , selected_flag : None , attachment_flag : None , highlight_self_flag : None , highlight_self : None , thread_subject_pack : None , threaded_repeat_identical_from_values : None , relative_menu_indices : None , relative_list_indices : None , hide_sidebar_on_launch : None } } }
|
||||
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct NotificationsSettingsOverride { # [doc = " Enable notifications."] # [doc = " Default: True"] # [serde (default)] pub enable : Option < bool > , # [doc = " A command to pipe notifications through."] # [doc = " Default: None"] # [serde (default)] pub script : Option < Option < String > > , # [doc = " A command to pipe new mail notifications through (preferred over"] # [doc = " `script`). Default: None"] # [serde (default)] pub new_mail_script : Option < Option < String > > , # [doc = " A file location which has its size changed when new mail arrives (max"] # [doc = " 128 bytes). Can be used to trigger new mail notifications eg with"] # [doc = " `xbiff(1)`. Default: None"] # [serde (alias = "xbiff-file-path")] # [serde (default)] pub xbiff_file_path : Option < Option < String > > , # [serde (alias = "play-sound")] # [serde (default)] pub play_sound : Option < ToggleFlag > , # [serde (alias = "sound-file")] # [serde (default)] pub sound_file : Option < Option < String > > } impl Default for NotificationsSettingsOverride { fn default () -> Self { NotificationsSettingsOverride { enable : None , script : None , new_mail_script : None , xbiff_file_path : None , play_sound : None , sound_file : None } } }
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct NotificationsSettingsOverride { # [doc = " Enable notifications."] # [doc = " Default: True"] # [serde (default)] pub enable : Option < bool > , # [doc = " A command to pipe notifications through."] # [doc = " Default: None"] # [serde (default)] pub script : Option < Option < String > > , # [doc = " A command to pipe new mail notifications through (preferred over"] # [doc = " `script`). Default: None"] # [serde (default)] pub new_mail_script : Option < Option < String > > , # [doc = " A file location which has its size changed when new mail arrives (max"] # [doc = " 128 bytes). Can be used to trigger new mail notifications eg with"] # [doc = " `xbiff(1)`. Default: None"] # [serde (alias = "xbiff-file-path")] # [serde (default)] pub xbiff_file_path : Option < Option < String > > , # [serde (alias = "play-sound")] # [serde (default)] pub play_sound : Option < ToggleFlag > , # [serde (alias = "sound-file")] # [serde (default)] pub sound_file : Option < Option < String > > } impl Default for NotificationsSettingsOverride { fn default () -> Self { Self { enable : None , script : None , new_mail_script : None , xbiff_file_path : None , play_sound : None , sound_file : None } } }
|
||||
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct ShortcutsOverride { # [serde (default)] pub general : Option < GeneralShortcuts > , # [serde (default)] pub listing : Option < ListingShortcuts > , # [serde (default)] pub composing : Option < ComposingShortcuts > , # [serde (alias = "contact-list")] # [serde (default)] pub contact_list : Option < ContactListShortcuts > , # [serde (alias = "envelope-view")] # [serde (default)] pub envelope_view : Option < EnvelopeViewShortcuts > , # [serde (alias = "thread-view")] # [serde (default)] pub thread_view : Option < ThreadViewShortcuts > , # [serde (default)] pub pager : Option < PagerShortcuts > } impl Default for ShortcutsOverride { fn default () -> Self { ShortcutsOverride { general : None , listing : None , composing : None , contact_list : None , envelope_view : None , thread_view : None , pager : None } } }
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct ShortcutsOverride { # [serde (default)] pub general : Option < GeneralShortcuts > , # [serde (default)] pub listing : Option < ListingShortcuts > , # [serde (default)] pub composing : Option < ComposingShortcuts > , # [serde (alias = "contact-list")] # [serde (default)] pub contact_list : Option < ContactListShortcuts > , # [serde (alias = "envelope-view")] # [serde (default)] pub envelope_view : Option < EnvelopeViewShortcuts > , # [serde (alias = "thread-view")] # [serde (default)] pub thread_view : Option < ThreadViewShortcuts > , # [serde (default)] pub pager : Option < PagerShortcuts > } impl Default for ShortcutsOverride { fn default () -> Self { Self { general : None , listing : None , composing : None , contact_list : None , envelope_view : None , thread_view : None , pager : None } } }
|
||||
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct ComposingSettingsOverride { # [doc = " A command to pipe new emails to"] # [doc = " Required"] # [serde (default)] pub send_mail : Option < SendMail > , # [doc = " Command to launch editor. Can have arguments. Draft filename is given as"] # [doc = " the last argument. If it's missing, the environment variable $EDITOR is"] # [doc = " looked up."] # [serde (alias = "editor-command" , alias = "editor-cmd" , alias = "editor_cmd")] # [serde (default)] pub editor_command : Option < Option < String > > , # [doc = " Embed editor (for terminal interfaces) instead of forking and waiting."] # [serde (default)] pub embed : Option < bool > , # [doc = " Set \"format=flowed\" in plain text attachments."] # [doc = " Default: true"] # [serde (alias = "format-flowed")] # [serde (default)] pub format_flowed : Option < bool > , # [doc = " Set User-Agent"] # [doc = " Default: empty"] # [serde (alias = "insert_user_agent")] # [serde (default)] pub insert_user_agent : Option < bool > , # [doc = " Set default header values for new drafts"] # [doc = " Default: empty"] # [serde (alias = "default-header-values")] # [serde (default)] pub default_header_values : Option < HashMap < HeaderName , String > > , # [doc = " Wrap header preample when editing a draft in an editor. This allows you"] # [doc = " to write non-plain text email without the preamble creating syntax"] # [doc = " errors. They are stripped when you return from the editor. The"] # [doc = " values should be a two element array of strings, a prefix and suffix."] # [doc = " Default: None"] # [serde (alias = "wrap-header-preample")] # [serde (default)] pub wrap_header_preamble : Option < Option < (String , String) > > , # [doc = " Store sent mail after successful submission. This setting is meant to be"] # [doc = " disabled for non-standard behaviour in gmail, which auto-saves sent"] # [doc = " mail on its own. Default: true"] # [serde (default)] pub store_sent_mail : Option < bool > , # [doc = " The attribution line appears above the quoted reply text."] # [doc = " The format specifiers for the replied address are:"] # [doc = " - `%+f` ā the sender's name and email address."] # [doc = " - `%+n` ā the sender's name (or email address, if no name is included)."] # [doc = " - `%+a` ā the sender's email address."] # [doc = " The format string is passed to strftime(3) with the replied envelope's"] # [doc = " date. Default: \"On %a, %0e %b %Y %H:%M, %+f wrote:%n\""] # [serde (default)] pub attribution_format_string : Option < Option < String > > , # [doc = " Whether the strftime call for the attribution string uses the POSIX"] # [doc = " locale instead of the user's active locale"] # [doc = " Default: true"] # [serde (default)] pub attribution_use_posix_locale : Option < bool > , # [doc = " Forward emails as attachment? (Alternative is inline)"] # [doc = " Default: ask"] # [serde (alias = "forward-as-attachment")] # [serde (default)] pub forward_as_attachment : Option < ToggleFlag > , # [doc = " Alternative lists of reply prefixes (etc. [\"Re:\", \"RE:\", ...]) to strip"] # [doc = " Default: `[\"Re:\", \"RE:\", \"Fwd:\", \"Fw:\", \"åå¤:\", \"åč¦:\", \"SV:\", \"Sv:\","] # [doc = " \"VS:\", \"Antw:\", \"Doorst:\", \"VS:\", \"VL:\", \"REF:\", \"TR:\", \"TR:\", \"AW:\","] # [doc = " \"WG:\", \"ĪĪ :\", \"ĪĻ:\", \"Ī±Ļ:\", \"Ī Ī”Ī:\", \"Ī ĻĪø:\", \"ĻĻĪø:\", \"Ī£Ī§ĪĪ¤:\", \"Ī£ĻĪµĻ:\","] # [doc = " \"ĻĻĪµĻ:\", \"Ī Ī”Ī:\", \"Ī ĻĪø:\", \"ĻĻĪø:\", \"VĆ”:\", \"TovĆ”bbĆtĆ”s:\", \"R:\", \"I:\","] # [doc = " \"RIF:\", \"FS:\", \"BLS:\", \"TRS:\", \"VS:\", \"VB:\", \"RV:\", \"RES:\", \"Res\","] # [doc = " \"ENC:\", \"Odp:\", \"PD:\", \"YNT:\", \"Ä°LT:\", \"ATB:\", \"YML:\"]`"] # [serde (alias = "reply-prefix-list-to-strip")] # [serde (default)] pub reply_prefix_list_to_strip : Option < Option < Vec < String > > > , # [doc = " The prefix to use in reply subjects. The de facto prefix is \"Re:\"."] # [serde (alias = "reply-prefix")] # [serde (default)] pub reply_prefix : Option < String > , # [doc = " Custom `compose-hooks`."] # [serde (alias = "custom-compose-hooks")] # [serde (default)] pub custom_compose_hooks : Option < Vec < ComposeHook > > , # [doc = " Disabled `compose-hooks`."] # [serde (alias = "disabled-compose-hooks")] # [serde (default)] pub disabled_compose_hooks : Option < Vec < String > > } impl Default for ComposingSettingsOverride { fn default () -> Self { ComposingSettingsOverride { send_mail : None , editor_command : None , embed : None , format_flowed : None , insert_user_agent : None , default_header_values : None , wrap_header_preamble : None , store_sent_mail : None , attribution_format_string : None , attribution_use_posix_locale : None , forward_as_attachment : None , reply_prefix_list_to_strip : None , reply_prefix : None , custom_compose_hooks : None , disabled_compose_hooks : None } } }
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct ComposingSettingsOverride { # [doc = " A command to pipe new emails to"] # [doc = " Required"] # [serde (default)] pub send_mail : Option < SendMail > , # [doc = " Command to launch editor. Can have arguments. Draft filename is given as"] # [doc = " the last argument. If it's missing, the environment variable $EDITOR is"] # [doc = " looked up."] # [serde (alias = "editor-command" , alias = "editor-cmd" , alias = "editor_cmd")] # [serde (default)] pub editor_command : Option < Option < String > > , # [doc = " Embedded editor (for terminal interfaces) instead of forking and"] # [doc = " waiting."] # [serde (alias = "embed")] # [serde (default)] pub embedded_pty : Option < bool > , # [doc = " Set \"format=flowed\" in plain text attachments."] # [doc = " Default: true"] # [serde (alias = "format-flowed")] # [serde (default)] pub format_flowed : Option < bool > , # [doc = " Set User-Agent"] # [doc = " Default: empty"] # [serde (alias = "insert_user_agent")] # [serde (default)] pub insert_user_agent : Option < bool > , # [doc = " Set default header values for new drafts"] # [doc = " Default: empty"] # [serde (alias = "default-header-values")] # [serde (default)] pub default_header_values : Option < HashMap < HeaderName , String > > , # [doc = " Wrap header preamble when editing a draft in an editor. This allows you"] # [doc = " to write non-plain text email without the preamble creating syntax"] # [doc = " errors. They are stripped when you return from the editor. The"] # [doc = " values should be a two element array of strings, a prefix and suffix."] # [doc = " Default: None"] # [serde (alias = "wrap-header-preamble")] # [serde (default)] pub wrap_header_preamble : Option < Option < (String , String) > > , # [doc = " Store sent mail after successful submission. This setting is meant to be"] # [doc = " disabled for non-standard behaviour in gmail, which auto-saves sent"] # [doc = " mail on its own. Default: true"] # [serde (default)] pub store_sent_mail : Option < bool > , # [doc = " The attribution line appears above the quoted reply text."] # [doc = " The format specifiers for the replied address are:"] # [doc = " - `%+f` ā the sender's name and email address."] # [doc = " - `%+n` ā the sender's name (or email address, if no name is included)."] # [doc = " - `%+a` ā the sender's email address."] # [doc = " The format string is passed to strftime(3) with the replied envelope's"] # [doc = " date. Default: \"On %a, %0e %b %Y %H:%M, %+f wrote:%n\""] # [serde (default)] pub attribution_format_string : Option < Option < String > > , # [doc = " Whether the strftime call for the attribution string uses the POSIX"] # [doc = " locale instead of the user's active locale"] # [doc = " Default: true"] # [serde (default)] pub attribution_use_posix_locale : Option < bool > , # [doc = " Forward emails as attachment? (Alternative is inline)"] # [doc = " Default: ask"] # [serde (alias = "forward-as-attachment")] # [serde (default)] pub forward_as_attachment : Option < ActionFlag > , # [doc = " Alternative lists of reply prefixes (etc. [\"Re:\", \"RE:\", ...]) to strip"] # [doc = " Default: `[\"Re:\", \"RE:\", \"Fwd:\", \"Fw:\", \"åå¤:\", \"åč¦:\", \"SV:\", \"Sv:\","] # [doc = " \"VS:\", \"Antw:\", \"Doorst:\", \"VS:\", \"VL:\", \"REF:\", \"TR:\", \"TR:\", \"AW:\","] # [doc = " \"WG:\", \"ĪĪ :\", \"ĪĻ:\", \"Ī±Ļ:\", \"Ī Ī”Ī:\", \"Ī ĻĪø:\", \"ĻĻĪø:\", \"Ī£Ī§ĪĪ¤:\", \"Ī£ĻĪµĻ:\","] # [doc = " \"ĻĻĪµĻ:\", \"Ī Ī”Ī:\", \"Ī ĻĪø:\", \"ĻĻĪø:\", \"VĆ”:\", \"TovĆ”bbĆtĆ”s:\", \"R:\", \"I:\","] # [doc = " \"RIF:\", \"FS:\", \"BLS:\", \"TRS:\", \"VS:\", \"VB:\", \"RV:\", \"RES:\", \"Res\","] # [doc = " \"ENC:\", \"Odp:\", \"PD:\", \"YNT:\", \"Ä°LT:\", \"ATB:\", \"YML:\"]`"] # [serde (alias = "reply-prefix-list-to-strip")] # [serde (default)] pub reply_prefix_list_to_strip : Option < Option < Vec < String > > > , # [doc = " The prefix to use in reply subjects. The de facto prefix is \"Re:\"."] # [serde (alias = "reply-prefix")] # [serde (default)] pub reply_prefix : Option < String > , # [doc = " Custom `compose-hooks`."] # [serde (alias = "custom-compose-hooks")] # [serde (default)] pub custom_compose_hooks : Option < Vec < ComposeHook > > , # [doc = " Disabled `compose-hooks`."] # [serde (alias = "disabled-compose-hooks")] # [serde (default)] pub disabled_compose_hooks : Option < Vec < String > > } impl Default for ComposingSettingsOverride { fn default () -> Self { Self { send_mail : None , editor_command : None , embedded_pty : None , format_flowed : None , insert_user_agent : None , default_header_values : None , wrap_header_preamble : None , store_sent_mail : None , attribution_format_string : None , attribution_use_posix_locale : None , forward_as_attachment : None , reply_prefix_list_to_strip : None , reply_prefix : None , custom_compose_hooks : None , disabled_compose_hooks : None } } }
|
||||
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct TagsSettingsOverride { # [serde (deserialize_with = "tag_color_de")] # [serde (default)] pub colors : Option < HashMap < TagHash , Color > > , # [serde (deserialize_with = "tag_set_de" , alias = "ignore-tags")] # [serde (default)] pub ignore_tags : Option < HashSet < TagHash > > } impl Default for TagsSettingsOverride { fn default () -> Self { TagsSettingsOverride { colors : None , ignore_tags : None } } }
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct TagsSettingsOverride { # [serde (deserialize_with = "tag_color_de")] # [serde (default)] pub colors : Option < HashMap < TagHash , Color > > , # [serde (deserialize_with = "tag_set_de" , alias = "ignore-tags")] # [serde (default)] pub ignore_tags : Option < HashSet < TagHash > > } impl Default for TagsSettingsOverride { fn default () -> Self { Self { colors : None , ignore_tags : None } } }
|
||||
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct PGPSettingsOverride { # [doc = " auto verify signed e-mail according to RFC3156"] # [doc = " Default: true"] # [serde (alias = "auto-verify-signatures")] # [serde (default)] pub auto_verify_signatures : Option < bool > , # [doc = " auto decrypt encrypted e-mail"] # [doc = " Default: true"] # [serde (alias = "auto-decrypt")] # [serde (default)] pub auto_decrypt : Option < bool > , # [doc = " always sign sent e-mail"] # [doc = " Default: false"] # [serde (alias = "auto-sign")] # [serde (default)] pub auto_sign : Option < bool > , # [doc = " Auto encrypt sent e-mail"] # [doc = " Default: false"] # [serde (alias = "auto-encrypt")] # [serde (default)] pub auto_encrypt : Option < bool > , # [doc = " Default: None"] # [serde (alias = "sign-key")] # [serde (default)] pub sign_key : Option < Option < String > > , # [doc = " Default: None"] # [serde (alias = "decrypt-key")] # [serde (default)] pub decrypt_key : Option < Option < String > > , # [doc = " Default: None"] # [serde (alias = "encrypt-key")] # [serde (default)] pub encrypt_key : Option < Option < String > > , # [doc = " Allow remote lookups"] # [doc = " Default: None"] # [serde (alias = "allow-remote-lookups")] # [serde (default)] pub allow_remote_lookup : Option < ToggleFlag > , # [doc = " Remote lookup mechanisms."] # [doc = " Default: \"local,wkd\""] # [cfg_attr (feature = "gpgme" , serde (alias = "remote-lookup-mechanisms"))] # [cfg (feature = "gpgme")] # [serde (default)] pub remote_lookup_mechanisms : Option < melib :: gpgme :: LocateKey > , # [cfg (not (feature = "gpgme"))] # [cfg_attr (not (feature = "gpgme") , serde (alias = "remote-lookup-mechanisms"))] # [serde (default)] pub remote_lookup_mechanisms : Option < String > } impl Default for PGPSettingsOverride { fn default () -> Self { PGPSettingsOverride { auto_verify_signatures : None , auto_decrypt : None , auto_sign : None , auto_encrypt : None , sign_key : None , decrypt_key : None , encrypt_key : None , allow_remote_lookup : None , remote_lookup_mechanisms : None } } }
|
||||
# [derive (Debug , Serialize , Deserialize , Clone)] # [serde (deny_unknown_fields)] pub struct PGPSettingsOverride { # [doc = " auto verify signed e-mail according to RFC3156"] # [doc = " Default: true"] # [serde (alias = "auto-verify-signatures")] # [serde (default)] pub auto_verify_signatures : Option < ActionFlag > , # [doc = " auto decrypt encrypted e-mail"] # [doc = " Default: true"] # [serde (alias = "auto-decrypt")] # [serde (default)] pub auto_decrypt : Option < ActionFlag > , # [doc = " always sign sent e-mail"] # [doc = " Default: false"] # [serde (alias = "auto-sign")] # [serde (default)] pub auto_sign : Option < ActionFlag > , # [doc = " Auto encrypt sent e-mail"] # [doc = " Default: false"] # [serde (alias = "auto-encrypt")] # [serde (default)] pub auto_encrypt : Option < ActionFlag > , # [doc = " Default: None"] # [serde (alias = "sign-key")] # [serde (default)] pub sign_key : Option < Option < String > > , # [doc = " Default: None"] # [serde (alias = "decrypt-key")] # [serde (default)] pub decrypt_key : Option < Option < String > > , # [doc = " Default: None"] # [serde (alias = "encrypt-key")] # [serde (default)] pub encrypt_key : Option < Option < String > > , # [doc = " Allow remote lookups"] # [doc = " Default: False"] # [serde (alias = "allow-remote-lookups")] # [serde (default)] pub allow_remote_lookup : Option < ActionFlag > , # [doc = " Remote lookup mechanisms."] # [doc = " Default: \"local,wkd\""] # [cfg_attr (feature = "gpgme" , serde (alias = "remote-lookup-mechanisms"))] # [cfg (feature = "gpgme")] # [serde (default)] pub remote_lookup_mechanisms : Option < melib :: gpgme :: LocateKey > , # [cfg (not (feature = "gpgme"))] # [cfg_attr (not (feature = "gpgme") , serde (alias = "remote-lookup-mechanisms"))] # [serde (default)] pub remote_lookup_mechanisms : Option < String > } impl Default for PGPSettingsOverride { fn default () -> Self { Self { auto_verify_signatures : None , auto_decrypt : None , auto_sign : None , auto_encrypt : None , sign_key : None , decrypt_key : None , encrypt_key : None , allow_remote_lookup : None , remote_lookup_mechanisms : None } } }
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ use melib::{Error, Result, ToggleFlag};
|
|||
use super::{default_vals::*, deserializers::*, DotAddressable};
|
||||
|
||||
/// Settings for the pager function.
|
||||
#[derive(Debug, Deserialize, Clone, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct PagerSettings {
|
||||
/// Number of context lines when going to next page.
|
||||
|
|
|
@ -19,33 +19,33 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use melib::conf::ToggleFlag;
|
||||
use melib::conf::ActionFlag;
|
||||
|
||||
use super::default_vals::*;
|
||||
|
||||
/// Settings for digital signing and encryption
|
||||
#[derive(Debug, Deserialize, Clone, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct PGPSettings {
|
||||
/// auto verify signed e-mail according to RFC3156
|
||||
/// Default: true
|
||||
#[serde(default = "true_val", alias = "auto-verify-signatures")]
|
||||
pub auto_verify_signatures: bool,
|
||||
pub auto_verify_signatures: ActionFlag,
|
||||
|
||||
/// auto decrypt encrypted e-mail
|
||||
/// Default: true
|
||||
#[serde(default = "true_val", alias = "auto-decrypt")]
|
||||
pub auto_decrypt: bool,
|
||||
pub auto_decrypt: ActionFlag,
|
||||
|
||||
/// always sign sent e-mail
|
||||
/// Default: false
|
||||
#[serde(default = "false_val", alias = "auto-sign")]
|
||||
pub auto_sign: bool,
|
||||
pub auto_sign: ActionFlag,
|
||||
|
||||
/// Auto encrypt sent e-mail
|
||||
/// Default: false
|
||||
#[serde(default = "false_val", alias = "auto-encrypt")]
|
||||
pub auto_encrypt: bool,
|
||||
pub auto_encrypt: ActionFlag,
|
||||
|
||||
// https://tools.ietf.org/html/rfc4880#section-12.2
|
||||
/// Default: None
|
||||
|
@ -61,9 +61,12 @@ pub struct PGPSettings {
|
|||
pub encrypt_key: Option<String>,
|
||||
|
||||
/// Allow remote lookups
|
||||
/// Default: None
|
||||
#[serde(default = "internal_value_false", alias = "allow-remote-lookups")]
|
||||
pub allow_remote_lookup: ToggleFlag,
|
||||
/// Default: False
|
||||
#[serde(
|
||||
default = "action_internal_value_false",
|
||||
alias = "allow-remote-lookups"
|
||||
)]
|
||||
pub allow_remote_lookup: ActionFlag,
|
||||
|
||||
/// Remote lookup mechanisms.
|
||||
/// Default: "local,wkd"
|
||||
|
@ -91,15 +94,15 @@ fn default_lookup_mechanism() -> melib::gpgme::LocateKey {
|
|||
|
||||
impl Default for PGPSettings {
|
||||
fn default() -> Self {
|
||||
PGPSettings {
|
||||
auto_verify_signatures: true,
|
||||
auto_decrypt: true,
|
||||
auto_sign: false,
|
||||
auto_encrypt: false,
|
||||
Self {
|
||||
auto_verify_signatures: true.into(),
|
||||
auto_decrypt: true.into(),
|
||||
auto_sign: false.into(),
|
||||
auto_encrypt: false.into(),
|
||||
sign_key: None,
|
||||
decrypt_key: None,
|
||||
encrypt_key: None,
|
||||
allow_remote_lookup: internal_value_false::<ToggleFlag>(),
|
||||
allow_remote_lookup: action_internal_value_false::<ActionFlag>(),
|
||||
#[cfg(feature = "gpgme")]
|
||||
remote_lookup_mechanisms: default_lookup_mechanism(),
|
||||
#[cfg(not(feature = "gpgme"))]
|
||||
|
|
|
@ -35,7 +35,7 @@ macro_rules! shortcut {
|
|||
};
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Shortcuts {
|
||||
#[serde(default)]
|
||||
|
@ -88,6 +88,12 @@ impl DotAddressable for Shortcuts {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CommandShortcut {
|
||||
pub shortcut: Key,
|
||||
pub command: Vec<String>,
|
||||
}
|
||||
|
||||
/// Create a struct holding all of a Component's shortcuts.
|
||||
#[macro_export]
|
||||
macro_rules! shortcut_key_values {
|
||||
|
@ -100,6 +106,7 @@ macro_rules! shortcut_key_values {
|
|||
#[serde(default)]
|
||||
#[serde(rename = $cname)]
|
||||
pub struct $name {
|
||||
pub commands: Vec<CommandShortcut>,
|
||||
$(pub $fname : Key),*
|
||||
}
|
||||
|
||||
|
@ -122,6 +129,7 @@ macro_rules! shortcut_key_values {
|
|||
impl Default for $name {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
commands : vec![],
|
||||
$($fname: $default),*
|
||||
}
|
||||
}
|
||||
|
@ -153,12 +161,12 @@ shortcut_key_values! { "listing",
|
|||
scroll_up |> "Scroll up list." |> Key::Char('k'),
|
||||
scroll_down |> "Scroll down list." |> Key::Char('j'),
|
||||
new_mail |> "Start new mail draft in new tab." |> Key::Char('m'),
|
||||
next_account |> "Go to next account." |> Key::Char('h'),
|
||||
next_account |> "Go to next account." |> Key::Char('H'),
|
||||
next_mailbox |> "Go to next mailbox." |> Key::Char('J'),
|
||||
next_page |> "Go to next page." |> Key::PageDown,
|
||||
prev_account |> "Go to previous account." |> Key::Char('l'),
|
||||
prev_account |> "Go to previous account." |> Key::Char('L'),
|
||||
prev_mailbox |> "Go to previous mailbox." |> Key::Char('K'),
|
||||
open_mailbox |> "Open selected mailbox" |> Key::Char('\n'),
|
||||
open_mailbox |> "Open selected mailbox." |> Key::Char('\n'),
|
||||
toggle_mailbox_collapse |> "Toggle mailbox collapse in menu." |> Key::Char(' '),
|
||||
prev_page |> "Go to previous page." |> Key::PageUp,
|
||||
search |> "Search within list of e-mails." |> Key::Char('/'),
|
||||
|
@ -189,8 +197,8 @@ shortcut_key_values! { "contact-list",
|
|||
edit_contact |> "Edit contact under cursor." |> Key::Char('e'),
|
||||
delete_contact |> "Delete contact under cursor." |> Key::Char('d'),
|
||||
mail_contact |> "Mail contact under cursor." |> Key::Char('m'),
|
||||
next_account |> "Go to next account." |> Key::Char('h'),
|
||||
prev_account |> "Go to previous account." |> Key::Char('l'),
|
||||
next_account |> "Go to next account." |> Key::Char('H'),
|
||||
prev_account |> "Go to previous account." |> Key::Char('L'),
|
||||
toggle_menu_visibility |> "Toggle visibility of side menu in mail list." |> Key::Char('`')
|
||||
}
|
||||
}
|
||||
|
@ -198,8 +206,8 @@ shortcut_key_values! { "contact-list",
|
|||
shortcut_key_values! { "pager",
|
||||
/// Shortcut listing for the text pager
|
||||
pub struct PagerShortcuts {
|
||||
page_down |> "Go to next pager page" |> Key::PageDown,
|
||||
page_up |> "Go to previous pager page" |> Key::PageUp,
|
||||
page_down |> "Go to next pager page." |> Key::PageDown,
|
||||
page_up |> "Go to previous pager page." |> Key::PageUp,
|
||||
scroll_down |> "Scroll down pager." |> Key::Char('j'),
|
||||
scroll_up |> "Scroll up pager." |> Key::Char('k')
|
||||
}
|
||||
|
@ -210,10 +218,10 @@ shortcut_key_values! { "general",
|
|||
toggle_help |> "Toggle help and shortcuts view." |> Key::Char('?'),
|
||||
enter_command_mode |> "Enter COMMAND mode." |> Key::Char(':'),
|
||||
quit |> "Quit meli." |> Key::Char('q'),
|
||||
go_to_tab |> "Go to the nth tab" |> Key::Alt('n'),
|
||||
next_tab |> "Next tab." |> Key::Char('T'),
|
||||
scroll_right |> "Generic scroll right (catch-all setting)" |> Key::Right,
|
||||
scroll_left |> "Generic scroll left (catch-all setting)" |> Key::Left,
|
||||
go_to_tab |> "Go to the nth tab." |> Key::Alt('n'),
|
||||
next_tab |> "Go to the next tab." |> Key::Char('T'),
|
||||
scroll_right |> "Generic scroll right (catch-all setting)" |> Key::Char('l'),
|
||||
scroll_left |> "Generic scroll left (catch-all setting)" |>Key::Char('h'),
|
||||
scroll_up |> "Generic scroll up (catch-all setting)" |> Key::Char('k'),
|
||||
scroll_down |> "Generic scroll down (catch-all setting)" |> Key::Char('j'),
|
||||
next_page |> "Go to next page. (catch-all setting)" |> Key::PageDown,
|
||||
|
@ -221,16 +229,18 @@ shortcut_key_values! { "general",
|
|||
home_page |> "Go to first page. (catch-all setting)" |> Key::Home,
|
||||
end_page |> "Go to last page. (catch-all setting)" |> Key::End,
|
||||
open_entry |> "Open list entry. (catch-all setting)" |> Key::Char('\n'),
|
||||
info_message_next |> "Show next info message, if any" |> Key::Alt('>'),
|
||||
info_message_previous |> "Show previous info message, if any" |> Key::Alt('<'),
|
||||
focus_in_text_field |> "Focus on a text field." |> Key::Char('\n')
|
||||
info_message_next |> "Show next info message, if any." |> Key::Alt('>'),
|
||||
info_message_previous |> "Show previous info message, if any." |> Key::Alt('<'),
|
||||
focus_in_text_field |> "Focus on a text field." |> Key::Char('\n'),
|
||||
next_search_result |> "Scroll to next search result." |> Key::Char('n'),
|
||||
previous_search_result |> "Scroll to previous search result." |> Key::Char('N')
|
||||
}
|
||||
}
|
||||
|
||||
shortcut_key_values! { "composing",
|
||||
pub struct ComposingShortcuts {
|
||||
edit |> "Edit." |> Key::Char('e'),
|
||||
send_mail |> "Deliver draft to mailer" |> Key::Char('s'),
|
||||
send_mail |> "Deliver draft to mailer." |> Key::Char('s'),
|
||||
scroll_up |> "Change field focus." |> Key::Char('k'),
|
||||
scroll_down |> "Change field focus." |> Key::Char('j')
|
||||
}
|
||||
|
@ -240,9 +250,10 @@ shortcut_key_values! { "envelope-view",
|
|||
pub struct EnvelopeViewShortcuts {
|
||||
add_addresses_to_contacts |> "Select addresses from envelope to add to contacts." |> Key::Char('c'),
|
||||
edit |> "Open envelope in composer." |> Key::Char('e'),
|
||||
go_to_url |> "Go to url of given index" |> Key::Char('g'),
|
||||
go_to_url |> "Go to url of given index." |> Key::Char('g'),
|
||||
open_attachment |> "Opens selected attachment with xdg-open." |> Key::Char('a'),
|
||||
open_mailcap |> "Opens selected attachment according to its mailcap entry." |> Key::Char('m'),
|
||||
open_html |> "Opens html attachment in the default browser." |> Key::Char('v'),
|
||||
reply |> "Reply to envelope." |> Key::Char('R'),
|
||||
reply_to_author |> "Reply to author." |> Key::Ctrl('r'),
|
||||
reply_to_all |> "Reply to all/Reply to list/Follow up." |> Key::Ctrl('g'),
|
||||
|
@ -259,12 +270,12 @@ shortcut_key_values! { "thread-view",
|
|||
pub struct ThreadViewShortcuts {
|
||||
scroll_up |> "Scroll up list." |> Key::Char('k'),
|
||||
scroll_down |> "Scroll down list." |> Key::Char('j'),
|
||||
collapse_subtree |> "collapse thread branches" |> Key::Char('h'),
|
||||
collapse_subtree |> "collapse thread branches." |> Key::Char('h'),
|
||||
next_page |> "Go to next page." |> Key::PageDown,
|
||||
prev_page |> "Go to previous page." |> Key::PageUp,
|
||||
reverse_thread_order |> "reverse thread order" |> Key::Ctrl('r'),
|
||||
toggle_mailview |> "toggle mail view visibility" |> Key::Char('p'),
|
||||
toggle_threadview |> "toggle thread view visibility" |> Key::Char('t'),
|
||||
reverse_thread_order |> "reverse thread order." |> Key::Ctrl('r'),
|
||||
toggle_mailview |> "toggle mail view visibility." |> Key::Char('p'),
|
||||
toggle_threadview |> "toggle thread view visibility." |> Key::Char('t'),
|
||||
toggle_layout |> "Toggle between horizontal and vertical layout." |> Key::Char(' ')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ use serde::{Deserialize, Deserializer};
|
|||
use super::DotAddressable;
|
||||
use crate::terminal::Color;
|
||||
|
||||
#[derive(Default, Debug, Deserialize, Clone, Serialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct TagsSettings {
|
||||
#[serde(default, deserialize_with = "tag_color_de")]
|
||||
|
|
|
@ -26,7 +26,7 @@ use melib::{Error, Result, ToggleFlag};
|
|||
use super::{deserializers::non_empty_opt_string, DotAddressable, Themes};
|
||||
|
||||
/// Settings for terminal display
|
||||
#[derive(Debug, Deserialize, Clone, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(default, deny_unknown_fields)]
|
||||
pub struct TerminalSettings {
|
||||
/// light, dark
|
||||
|
@ -55,7 +55,7 @@ pub struct TerminalSettings {
|
|||
|
||||
impl Default for TerminalSettings {
|
||||
fn default() -> Self {
|
||||
TerminalSettings {
|
||||
Self {
|
||||
theme: "dark".to_string(),
|
||||
themes: Themes::default(),
|
||||
ascii_drawing: false,
|
||||
|
@ -109,7 +109,7 @@ impl DotAddressable for TerminalSettings {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ProgressSpinnerSequence {
|
||||
Integer(usize),
|
||||
|
|
|
@ -323,7 +323,7 @@ const DEFAULT_KEYS: &[&str] = &[
|
|||
];
|
||||
|
||||
/// `ThemeAttributeInner` but with the links resolved.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Default, Copy, Serialize, Deserialize)]
|
||||
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct ThemeAttribute {
|
||||
pub fg: Color,
|
||||
|
@ -332,7 +332,7 @@ pub struct ThemeAttribute {
|
|||
}
|
||||
|
||||
/// Holds {fore,back}ground color and terminal attribute values.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct ThemeAttributeInner {
|
||||
#[serde(default)]
|
||||
|
@ -353,7 +353,7 @@ impl Default for ThemeAttributeInner {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum ColorField {
|
||||
// Like self, i.e. either Fg or Bg
|
||||
LikeSelf,
|
||||
|
@ -361,22 +361,22 @@ pub enum ColorField {
|
|||
Bg,
|
||||
}
|
||||
|
||||
/// The field a ThemeValue::Link refers to.
|
||||
/// The field a `ThemeValue::Link` refers to.
|
||||
trait ThemeLink {
|
||||
type LinkType;
|
||||
}
|
||||
|
||||
/// A color value that's a link can either refer to .fg or .bg field
|
||||
/// A color value that's a link can either refer to `.fg` or `.bg` field
|
||||
impl ThemeLink for Color {
|
||||
type LinkType = ColorField;
|
||||
}
|
||||
|
||||
/// An attr value that's a link can only refer to an .attr field
|
||||
/// An `attr` value that's a link can only refer to an `.attr` field
|
||||
impl ThemeLink for Attr {
|
||||
type LinkType = ();
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
/// Holds either an actual value or refers to the key name of the attribute that
|
||||
/// holds the value.
|
||||
enum ThemeValue<T: ThemeLink> {
|
||||
|
@ -387,37 +387,37 @@ enum ThemeValue<T: ThemeLink> {
|
|||
|
||||
impl From<&'static str> for ThemeValue<Color> {
|
||||
fn from(from: &'static str) -> Self {
|
||||
ThemeValue::Link(from.into(), ColorField::LikeSelf)
|
||||
Self::Link(from.into(), ColorField::LikeSelf)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&'static str> for ThemeValue<Attr> {
|
||||
fn from(from: &'static str) -> Self {
|
||||
ThemeValue::Link(from.into(), ())
|
||||
Self::Link(from.into(), ())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Color> for ThemeValue<Color> {
|
||||
fn from(from: Color) -> Self {
|
||||
ThemeValue::Value(from)
|
||||
Self::Value(from)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Attr> for ThemeValue<Attr> {
|
||||
fn from(from: Attr) -> Self {
|
||||
ThemeValue::Value(from)
|
||||
Self::Value(from)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ThemeValue<Color> {
|
||||
fn default() -> Self {
|
||||
ThemeValue::Value(Color::Default)
|
||||
Self::Value(Color::Default)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ThemeValue<Attr> {
|
||||
fn default() -> Self {
|
||||
ThemeValue::Value(Attr::DEFAULT)
|
||||
Self::Value(Attr::DEFAULT)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,11 +428,11 @@ impl<'de> Deserialize<'de> for ThemeValue<Attr> {
|
|||
{
|
||||
if let Ok(s) = <String>::deserialize(deserializer) {
|
||||
if let Some(stripped) = s.strip_prefix('$') {
|
||||
Ok(ThemeValue::Alias(stripped.to_string().into()))
|
||||
Ok(Self::Alias(stripped.to_string().into()))
|
||||
} else if let Ok(c) = Attr::from_string_de::<'de, D, String>(s.clone()) {
|
||||
Ok(ThemeValue::Value(c))
|
||||
Ok(Self::Value(c))
|
||||
} else {
|
||||
Ok(ThemeValue::Link(s.into(), ()))
|
||||
Ok(Self::Link(s.into(), ()))
|
||||
}
|
||||
} else {
|
||||
Err(de::Error::custom("invalid theme attribute value"))
|
||||
|
@ -446,9 +446,9 @@ impl Serialize for ThemeValue<Attr> {
|
|||
S: Serializer,
|
||||
{
|
||||
match self {
|
||||
ThemeValue::Value(s) => s.serialize(serializer),
|
||||
ThemeValue::Alias(s) => format!("${}", s).serialize(serializer),
|
||||
ThemeValue::Link(s, ()) => serializer.serialize_str(s.as_ref()),
|
||||
Self::Value(s) => s.serialize(serializer),
|
||||
Self::Alias(s) => format!("${}", s).serialize(serializer),
|
||||
Self::Link(s, ()) => serializer.serialize_str(s.as_ref()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -459,15 +459,11 @@ impl Serialize for ThemeValue<Color> {
|
|||
S: Serializer,
|
||||
{
|
||||
match self {
|
||||
ThemeValue::Value(s) => s.serialize(serializer),
|
||||
ThemeValue::Alias(s) => format!("${}", s).serialize(serializer),
|
||||
ThemeValue::Link(s, ColorField::LikeSelf) => serializer.serialize_str(s.as_ref()),
|
||||
ThemeValue::Link(s, ColorField::Fg) => {
|
||||
serializer.serialize_str(format!("{}.fg", s).as_ref())
|
||||
}
|
||||
ThemeValue::Link(s, ColorField::Bg) => {
|
||||
serializer.serialize_str(format!("{}.bg", s).as_ref())
|
||||
}
|
||||
Self::Value(s) => s.serialize(serializer),
|
||||
Self::Alias(s) => format!("${}", s).serialize(serializer),
|
||||
Self::Link(s, ColorField::LikeSelf) => serializer.serialize_str(s.as_ref()),
|
||||
Self::Link(s, ColorField::Fg) => serializer.serialize_str(format!("{}.fg", s).as_ref()),
|
||||
Self::Link(s, ColorField::Bg) => serializer.serialize_str(format!("{}.bg", s).as_ref()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -479,21 +475,21 @@ impl<'de> Deserialize<'de> for ThemeValue<Color> {
|
|||
{
|
||||
if let Ok(s) = <String>::deserialize(deserializer) {
|
||||
if let Some(stripped) = s.strip_prefix('$') {
|
||||
Ok(ThemeValue::Alias(stripped.to_string().into()))
|
||||
Ok(Self::Alias(stripped.to_string().into()))
|
||||
} else if let Ok(c) = Color::from_string_de::<'de, D>(s.clone()) {
|
||||
Ok(ThemeValue::Value(c))
|
||||
Ok(Self::Value(c))
|
||||
} else if s.ends_with(".fg") {
|
||||
Ok(ThemeValue::Link(
|
||||
Ok(Self::Link(
|
||||
s[..s.len() - 3].to_string().into(),
|
||||
ColorField::Fg,
|
||||
))
|
||||
} else if s.ends_with(".bg") {
|
||||
Ok(ThemeValue::Link(
|
||||
Ok(Self::Link(
|
||||
s[..s.len() - 3].to_string().into(),
|
||||
ColorField::Bg,
|
||||
))
|
||||
} else {
|
||||
Ok(ThemeValue::Link(s.into(), ColorField::LikeSelf))
|
||||
Ok(Self::Link(s.into(), ColorField::LikeSelf))
|
||||
}
|
||||
} else {
|
||||
Err(de::Error::custom("invalid theme color value"))
|
||||
|
@ -501,14 +497,14 @@ impl<'de> Deserialize<'de> for ThemeValue<Color> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Themes {
|
||||
pub light: Theme,
|
||||
pub dark: Theme,
|
||||
pub other_themes: IndexMap<String, Theme>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Theme {
|
||||
color_aliases: IndexMap<Cow<'static, str>, ThemeValue<Color>>,
|
||||
attr_aliases: IndexMap<Cow<'static, str>, ThemeValue<Attr>>,
|
||||
|
@ -533,7 +529,7 @@ mod regexp {
|
|||
#[derive(Clone)]
|
||||
pub struct RegexpWrapper(pub pcre2::bytes::Regex);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub(super) struct TextFormatterSetting {
|
||||
pub(super) regexp: RegexpWrapper,
|
||||
pub(super) fg: Option<ThemeValue<Color>>,
|
||||
|
@ -542,7 +538,7 @@ mod regexp {
|
|||
pub(super) priority: u8,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct TextFormatter<'r> {
|
||||
pub regexp: &'r RegexpWrapper,
|
||||
pub tag: FormatTag,
|
||||
|
@ -569,7 +565,7 @@ mod regexp {
|
|||
impl Eq for RegexpWrapper {}
|
||||
|
||||
impl PartialEq for RegexpWrapper {
|
||||
fn eq(&self, other: &RegexpWrapper) -> bool {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.0.as_str().eq(other.0.as_str())
|
||||
}
|
||||
}
|
||||
|
@ -784,7 +780,7 @@ impl<'de> Deserialize<'de> for Themes {
|
|||
#[serde(flatten, default)]
|
||||
other_themes: IndexMap<String, ThemeOptions>,
|
||||
}
|
||||
#[derive(Deserialize, Default)]
|
||||
#[derive(Default, Deserialize)]
|
||||
struct ThemeOptions {
|
||||
#[serde(default)]
|
||||
color_aliases: IndexMap<Cow<'static, str>, ThemeValue<Color>>,
|
||||
|
@ -797,7 +793,7 @@ impl<'de> Deserialize<'de> for Themes {
|
|||
keys: IndexMap<Cow<'static, str>, ThemeAttributeInnerOptions>,
|
||||
}
|
||||
#[cfg(feature = "regexp")]
|
||||
#[derive(Deserialize, Default)]
|
||||
#[derive(Default, Deserialize)]
|
||||
struct RegexpOptions {
|
||||
#[serde(default = "false_val")]
|
||||
caseless: bool,
|
||||
|
@ -816,7 +812,7 @@ impl<'de> Deserialize<'de> for Themes {
|
|||
#[serde(flatten)]
|
||||
rest: ThemeAttributeInnerOptions,
|
||||
}
|
||||
#[derive(Deserialize, Default)]
|
||||
#[derive(Default, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct ThemeAttributeInnerOptions {
|
||||
#[serde(default)]
|
||||
|
@ -827,7 +823,7 @@ impl<'de> Deserialize<'de> for Themes {
|
|||
attrs: Option<ThemeValue<Attr>>,
|
||||
}
|
||||
|
||||
let mut ret = Themes::default();
|
||||
let mut ret = Self::default();
|
||||
let mut s = <ThemesOptions>::deserialize(deserializer)?;
|
||||
for tk in s.other_themes.keys() {
|
||||
ret.other_themes.insert(tk.clone(), ret.dark.clone());
|
||||
|
@ -1037,7 +1033,7 @@ impl Themes {
|
|||
}
|
||||
ThemeValue::Alias(ref ident) => {
|
||||
if !theme.color_aliases.contains_key(ident.as_ref()) {
|
||||
Some((Some(key), "alias", "nonexistant color alias", ident))
|
||||
Some((Some(key), "alias", "nonexistent color alias", ident))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -1054,7 +1050,7 @@ impl Themes {
|
|||
}
|
||||
ThemeValue::Alias(ref ident) => {
|
||||
if !theme.attr_aliases.contains_key(ident.as_ref()) {
|
||||
Some((Some(key), "alias", "nonexistant color alias", ident))
|
||||
Some((Some(key), "alias", "nonexistent color alias", ident))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -1070,7 +1066,7 @@ impl Themes {
|
|||
}
|
||||
} else if let ThemeValue::Alias(ref ident) = a.fg {
|
||||
if !theme.color_aliases.contains_key(ident.as_ref()) {
|
||||
Some((Some(key), "fg alias", "nonexistant color alias", ident))
|
||||
Some((Some(key), "fg alias", "nonexistent color alias", ident))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -1087,7 +1083,7 @@ impl Themes {
|
|||
}
|
||||
} else if let ThemeValue::Alias(ref ident) = a.bg {
|
||||
if !theme.color_aliases.contains_key(ident.as_ref()) {
|
||||
Some((Some(key), "bg alias", "nonexistant color alias", ident))
|
||||
Some((Some(key), "bg alias", "nonexistent color alias", ident))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -1107,7 +1103,7 @@ impl Themes {
|
|||
Some((
|
||||
Some(key),
|
||||
"attrs alias",
|
||||
"nonexistant text attribute alias",
|
||||
"nonexistent text attribute alias",
|
||||
ident,
|
||||
))
|
||||
} else {
|
||||
|
@ -1145,7 +1141,7 @@ impl Themes {
|
|||
keys.push((
|
||||
Some(key),
|
||||
"fg alias",
|
||||
"nonexistant color alias in `text_format_regexps`",
|
||||
"nonexistent color alias in `text_format_regexps`",
|
||||
ident,
|
||||
));
|
||||
}
|
||||
|
@ -1166,7 +1162,7 @@ impl Themes {
|
|||
keys.push((
|
||||
Some(key),
|
||||
"bg alias",
|
||||
"nonexistant color alias in `text_format_regexps`",
|
||||
"nonexistent color alias in `text_format_regexps`",
|
||||
ident,
|
||||
));
|
||||
}
|
||||
|
@ -1187,7 +1183,7 @@ impl Themes {
|
|||
keys.push((
|
||||
Some(key),
|
||||
"attrs alias",
|
||||
"nonexistant text attribute alias in `text_format_regexps`",
|
||||
"nonexistent text attribute alias in `text_format_regexps`",
|
||||
ident,
|
||||
));
|
||||
}
|
||||
|
@ -1217,10 +1213,10 @@ impl Themes {
|
|||
}
|
||||
pub fn validate(&self) -> Result<()> {
|
||||
let hash_set: HashSet<&'static str> = DEFAULT_KEYS.iter().copied().collect();
|
||||
Themes::validate_keys("light", &self.light, &hash_set)?;
|
||||
Themes::validate_keys("dark", &self.dark, &hash_set)?;
|
||||
Self::validate_keys("light", &self.light, &hash_set)?;
|
||||
Self::validate_keys("dark", &self.dark, &hash_set)?;
|
||||
for (name, t) in self.other_themes.iter() {
|
||||
Themes::validate_keys(name, t, &hash_set)?;
|
||||
Self::validate_keys(name, t, &hash_set)?;
|
||||
}
|
||||
if let Err(err) = is_cyclic(&self.light) {
|
||||
return Err(Error::new(format!("light theme contains a cycle: {}", err)));
|
||||
|
@ -1288,7 +1284,7 @@ impl std::fmt::Display for Themes {
|
|||
|
||||
impl Default for Themes {
|
||||
#[allow(clippy::needless_update)]
|
||||
fn default() -> Themes {
|
||||
fn default() -> Self {
|
||||
let mut light = IndexMap::default();
|
||||
let mut dark = IndexMap::default();
|
||||
let other_themes = IndexMap::default();
|
||||
|
@ -1734,7 +1730,7 @@ impl Default for Themes {
|
|||
|
||||
add!("pager.highlight_search", light = { fg: Color::White, bg: Color::Byte(6) /* Teal */, attrs: Attr::BOLD }, dark = { fg: Color::White, bg: Color::Byte(6) /* Teal */, attrs: Attr::BOLD });
|
||||
add!("pager.highlight_search_current", light = { fg: Color::White, bg: Color::Byte(17) /* NavyBlue */, attrs: Attr::BOLD }, dark = { fg: Color::White, bg: Color::Byte(17) /* NavyBlue */, attrs: Attr::BOLD });
|
||||
Themes {
|
||||
Self {
|
||||
light: Theme {
|
||||
keys: light,
|
||||
attr_aliases: Default::default(),
|
||||
|
@ -1815,7 +1811,7 @@ impl Serialize for Themes {
|
|||
|
||||
/* Check Theme linked values for cycles */
|
||||
fn is_cyclic(theme: &Theme) -> std::result::Result<(), String> {
|
||||
#[derive(Hash, Copy, Clone, PartialEq, Eq)]
|
||||
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
|
||||
enum Course {
|
||||
Fg,
|
||||
Bg,
|
||||
|
@ -2085,7 +2081,7 @@ fn is_cyclic(theme: &Theme) -> std::result::Result<(), String> {
|
|||
fn test_theme_parsing() {
|
||||
/* MUST SUCCEED: default themes should be valid */
|
||||
let def = Themes::default();
|
||||
assert!(def.validate().is_ok());
|
||||
def.validate().unwrap();
|
||||
/* MUST SUCCEED: new user theme `hunter2`, theme `dark` has user
|
||||
* redefinitions */
|
||||
const TEST_STR: &str = r#"[dark]
|
||||
|
@ -2121,27 +2117,27 @@ fn test_theme_parsing() {
|
|||
),
|
||||
Color::Byte(15), // White
|
||||
);
|
||||
assert!(parsed.validate().is_ok());
|
||||
parsed.validate().unwrap();
|
||||
/* MUST FAIL: theme `dark` contains a cycle */
|
||||
const HAS_CYCLE: &str = r#"[dark]
|
||||
"mail.listing.compact.even" = { fg = "mail.listing.compact.odd" }
|
||||
"mail.listing.compact.odd" = { fg = "mail.listing.compact.even" }
|
||||
"#;
|
||||
let parsed: Themes = toml::from_str(HAS_CYCLE).unwrap();
|
||||
assert!(parsed.validate().is_err());
|
||||
parsed.validate().unwrap_err();
|
||||
/* MUST FAIL: theme `dark` contains an invalid key */
|
||||
const HAS_INVALID_KEYS: &str = r#"[dark]
|
||||
"asdfsafsa" = { fg = "Black" }
|
||||
"#;
|
||||
let parsed: std::result::Result<Themes, _> = toml::from_str(HAS_INVALID_KEYS);
|
||||
assert!(parsed.is_err());
|
||||
parsed.unwrap_err();
|
||||
/* MUST SUCCEED: alias $Jebediah resolves to a valid color */
|
||||
const TEST_ALIAS_STR: &str = r##"[dark]
|
||||
color_aliases= { "Jebediah" = "#b4da55" }
|
||||
"mail.listing.tag_default" = { fg = "$Jebediah" }
|
||||
"##;
|
||||
let parsed: Themes = toml::from_str(TEST_ALIAS_STR).unwrap();
|
||||
assert!(parsed.validate().is_ok());
|
||||
parsed.validate().unwrap();
|
||||
assert_eq!(
|
||||
unlink_fg(
|
||||
&parsed.dark,
|
||||
|
@ -2150,48 +2146,48 @@ color_aliases= { "Jebediah" = "#b4da55" }
|
|||
),
|
||||
Color::Rgb(180, 218, 85)
|
||||
);
|
||||
/* MUST FAIL: Mispell color alias $Jebediah as $Jebedia */
|
||||
/* MUST FAIL: Misspell color alias $Jebediah as $Jebedia */
|
||||
const TEST_INVALID_ALIAS_STR: &str = r##"[dark]
|
||||
color_aliases= { "Jebediah" = "#b4da55" }
|
||||
"mail.listing.tag_default" = { fg = "$Jebedia" }
|
||||
"##;
|
||||
let parsed: Themes = toml::from_str(TEST_INVALID_ALIAS_STR).unwrap();
|
||||
assert!(parsed.validate().is_err());
|
||||
parsed.validate().unwrap_err();
|
||||
/* MUST FAIL: Color alias $Jebediah is defined as itself */
|
||||
const TEST_CYCLIC_ALIAS_STR: &str = r#"[dark]
|
||||
color_aliases= { "Jebediah" = "$Jebediah" }
|
||||
"mail.listing.tag_default" = { fg = "$Jebediah" }
|
||||
"#;
|
||||
let parsed: Themes = toml::from_str(TEST_CYCLIC_ALIAS_STR).unwrap();
|
||||
assert!(parsed.validate().is_err());
|
||||
parsed.validate().unwrap_err();
|
||||
/* MUST FAIL: Attr alias $Jebediah is defined as itself */
|
||||
const TEST_CYCLIC_ALIAS_ATTR_STR: &str = r#"[dark]
|
||||
attr_aliases= { "Jebediah" = "$Jebediah" }
|
||||
"mail.listing.tag_default" = { attrs = "$Jebediah" }
|
||||
"#;
|
||||
let parsed: Themes = toml::from_str(TEST_CYCLIC_ALIAS_ATTR_STR).unwrap();
|
||||
assert!(parsed.validate().is_err());
|
||||
parsed.validate().unwrap_err();
|
||||
/* MUST FAIL: alias $Jebediah resolves to a cycle */
|
||||
const TEST_CYCLIC_ALIAS_STR_2: &str = r#"[dark]
|
||||
color_aliases= { "Jebediah" = "$JebediahJr", "JebediahJr" = "mail.listing.tag_default" }
|
||||
"mail.listing.tag_default" = { fg = "$Jebediah" }
|
||||
"#;
|
||||
let parsed: Themes = toml::from_str(TEST_CYCLIC_ALIAS_STR_2).unwrap();
|
||||
assert!(parsed.validate().is_err());
|
||||
parsed.validate().unwrap_err();
|
||||
/* MUST SUCCEED: alias $Jebediah resolves to a key's field */
|
||||
const TEST_CYCLIC_ALIAS_STR_3: &str = r#"[dark]
|
||||
color_aliases= { "Jebediah" = "$JebediahJr", "JebediahJr" = "mail.listing.tag_default.bg" }
|
||||
"mail.listing.tag_default" = { fg = "$Jebediah", bg = "Black" }
|
||||
"#;
|
||||
let parsed: Themes = toml::from_str(TEST_CYCLIC_ALIAS_STR_3).unwrap();
|
||||
assert!(parsed.validate().is_ok());
|
||||
parsed.validate().unwrap();
|
||||
/* MUST FAIL: alias $Jebediah resolves to an invalid key */
|
||||
const TEST_INVALID_LINK_KEY_FIELD_STR: &str = r#"[dark]
|
||||
color_aliases= { "Jebediah" = "$JebediahJr", "JebediahJr" = "mail.listing.tag_default.attrs" }
|
||||
"mail.listing.tag_default" = { fg = "$Jebediah", bg = "Black" }
|
||||
"#;
|
||||
let parsed: Themes = toml::from_str(TEST_INVALID_LINK_KEY_FIELD_STR).unwrap();
|
||||
assert!(parsed.validate().is_err());
|
||||
parsed.validate().unwrap_err();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -19,13 +19,12 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use melib::Card;
|
||||
|
||||
use crate::{
|
||||
terminal::*, Action::*, CellBuffer, Component, ComponentId, Context, Field, FormWidget, Key,
|
||||
StatusEvent, TabAction, ThemeAttribute, UIDialog, UIEvent,
|
||||
terminal::*, CellBuffer, Component, ComponentId, Context, Field, FormWidget, Key, StatusEvent,
|
||||
ThemeAttribute, UIDialog, UIEvent,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -33,7 +32,6 @@ enum ViewMode {
|
|||
ReadOnly,
|
||||
Discard(Box<UIDialog<char>>),
|
||||
Edit,
|
||||
//New,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -44,11 +42,10 @@ pub struct ContactManager {
|
|||
mode: ViewMode,
|
||||
form: FormWidget<bool>,
|
||||
pub account_pos: usize,
|
||||
content: CellBuffer,
|
||||
content: Screen<Virtual>,
|
||||
theme_default: ThemeAttribute,
|
||||
dirty: bool,
|
||||
has_changes: bool,
|
||||
|
||||
initialized: bool,
|
||||
}
|
||||
|
||||
|
@ -61,14 +58,14 @@ impl std::fmt::Display for ContactManager {
|
|||
impl ContactManager {
|
||||
pub fn new(context: &Context) -> Self {
|
||||
let theme_default: ThemeAttribute = crate::conf::value(context, "theme_default");
|
||||
ContactManager {
|
||||
Self {
|
||||
id: ComponentId::default(),
|
||||
parent_id: None,
|
||||
card: Card::new(),
|
||||
mode: ViewMode::Edit,
|
||||
form: FormWidget::default(),
|
||||
account_pos: 0,
|
||||
content: CellBuffer::new_with_context(100, 1, None, context),
|
||||
content: Screen::<Virtual>::new(),
|
||||
theme_default,
|
||||
dirty: true,
|
||||
has_changes: false,
|
||||
|
@ -77,37 +74,38 @@ impl ContactManager {
|
|||
}
|
||||
|
||||
fn initialize(&mut self, context: &Context) {
|
||||
let (width, _) = self.content.size();
|
||||
if !self.content.resize_with_context(100, 1, context) {
|
||||
return;
|
||||
}
|
||||
let mut area = self.content.area();
|
||||
|
||||
let (x, _) = write_string_to_grid(
|
||||
let (x, _) = self.content.grid_mut().write_string(
|
||||
"Last edited: ",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, 0), (width - 1, 0)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
let (x, y) = write_string_to_grid(
|
||||
area = area.skip_cols(x);
|
||||
let (x, y) = self.content.grid_mut().write_string(
|
||||
&self.card.last_edited(),
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((x, 0), (width - 1, 0)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
area = area.skip(x, y);
|
||||
|
||||
if self.card.external_resource() {
|
||||
self.mode = ViewMode::ReadOnly;
|
||||
let _ = self.content.resize(self.content.size().0, 2, None);
|
||||
write_string_to_grid(
|
||||
self.content.grid_mut().write_string(
|
||||
"This contact's origin is external and cannot be edited within meli.",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((x, y), (width - 1, y)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
@ -150,23 +148,15 @@ impl Component for ContactManager {
|
|||
self.initialized = true;
|
||||
}
|
||||
|
||||
let upper_left = upper_left!(area);
|
||||
let bottom_right = bottom_right!(area);
|
||||
|
||||
if self.dirty {
|
||||
let (width, _height) = self.content.size();
|
||||
clear_area(
|
||||
grid,
|
||||
(upper_left, set_y(bottom_right, get_y(upper_left) + 1)),
|
||||
self.theme_default,
|
||||
);
|
||||
copy_area_with_break(grid, &self.content, area, ((0, 0), (width - 1, 0)));
|
||||
if self.is_dirty() {
|
||||
grid.clear_area(area, self.theme_default);
|
||||
grid.copy_area(self.content.grid(), area.skip_rows(2), self.content.area());
|
||||
self.dirty = false;
|
||||
}
|
||||
|
||||
self.form.draw(
|
||||
grid,
|
||||
(set_y(upper_left, get_y(upper_left) + 2), bottom_right),
|
||||
area.skip_rows(2 + self.content.area().height()),
|
||||
context,
|
||||
);
|
||||
if let ViewMode::Discard(ref mut selector) = self.mode {
|
||||
|
@ -180,23 +170,27 @@ impl Component for ContactManager {
|
|||
fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool {
|
||||
if let UIEvent::ConfigReload { old_settings: _ } = event {
|
||||
self.theme_default = crate::conf::value(context, "theme_default");
|
||||
self.content = CellBuffer::new_with_context(100, 1, None, context);
|
||||
self.content.grid_mut().empty();
|
||||
self.initialized = false;
|
||||
self.set_dirty(true);
|
||||
}
|
||||
match self.mode {
|
||||
ViewMode::Discard(ref mut selector) => {
|
||||
if matches!(event, UIEvent::ComponentUnrealize(ref id) if *id == selector.id()) {
|
||||
selector.unrealize(context);
|
||||
self.mode = ViewMode::Edit;
|
||||
self.set_dirty(true);
|
||||
return true;
|
||||
}
|
||||
if selector.process_event(event, context) {
|
||||
self.set_dirty(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ViewMode::Edit => {
|
||||
if let (Some(parent_id), &UIEvent::Input(Key::Esc)) = (self.parent_id, &event) {
|
||||
if matches!(event, UIEvent::Input(Key::Esc)) {
|
||||
if self.can_quit_cleanly(context) {
|
||||
context
|
||||
.replies
|
||||
.push_back(UIEvent::Action(Tab(TabAction::Kill(parent_id))));
|
||||
self.unrealize(context);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -205,7 +199,7 @@ impl Component for ContactManager {
|
|||
None => {}
|
||||
Some(true) => {
|
||||
let fields = std::mem::take(&mut self.form).collect().unwrap();
|
||||
let fields: HashMap<String, String> = fields
|
||||
let fields: IndexMap<String, String> = fields
|
||||
.into_iter()
|
||||
.map(|(s, v)| {
|
||||
(
|
||||
|
@ -232,14 +226,14 @@ impl Component for ContactManager {
|
|||
}
|
||||
}
|
||||
self.set_dirty(true);
|
||||
if let UIEvent::InsertInput(_) = event {
|
||||
if matches!(event, UIEvent::InsertInput(_)) {
|
||||
self.has_changes = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ViewMode::ReadOnly => {
|
||||
if let &mut UIEvent::Input(Key::Esc) = event {
|
||||
if matches!(event, UIEvent::Input(Key::Esc)) {
|
||||
if self.can_quit_cleanly(context) {
|
||||
self.unrealize(context);
|
||||
}
|
||||
|
@ -253,11 +247,7 @@ impl Component for ContactManager {
|
|||
fn is_dirty(&self) -> bool {
|
||||
self.dirty
|
||||
|| self.form.is_dirty()
|
||||
|| if let ViewMode::Discard(ref selector) = self.mode {
|
||||
selector.is_dirty()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|| matches!(self.mode, ViewMode::Discard(ref selector) if selector.is_dirty())
|
||||
}
|
||||
|
||||
fn set_dirty(&mut self, value: bool) {
|
||||
|
@ -277,28 +267,31 @@ impl Component for ContactManager {
|
|||
return true;
|
||||
}
|
||||
|
||||
if let Some(parent_id) = self.parent_id {
|
||||
if matches!(self.mode, ViewMode::Discard(_)) {
|
||||
true
|
||||
} else {
|
||||
let Some(parent_id) = self.parent_id else {
|
||||
return true;
|
||||
};
|
||||
/* Play it safe and ask user for confirmation */
|
||||
self.mode = ViewMode::Discard(Box::new(UIDialog::new(
|
||||
"this contact has unsaved changes",
|
||||
vec![
|
||||
('x', "quit without saving".to_string()),
|
||||
('y', "save draft and quit".to_string()),
|
||||
('y', "quit without saving".to_string()),
|
||||
('n', "cancel".to_string()),
|
||||
],
|
||||
true,
|
||||
Some(Box::new(move |_, results: &[char]| match results[0] {
|
||||
'x' => Some(UIEvent::Action(Tab(TabAction::Kill(parent_id)))),
|
||||
'n' => None,
|
||||
'y' => None,
|
||||
_ => None,
|
||||
Some(Box::new(move |id, results: &[char]| {
|
||||
if matches!(results.first(), Some(&'y')) {
|
||||
Some(UIEvent::ComponentUnrealize(parent_id))
|
||||
} else {
|
||||
Some(UIEvent::ComponentUnrealize(id))
|
||||
}
|
||||
})),
|
||||
context,
|
||||
)));
|
||||
self.set_dirty(true);
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
use std::cmp;
|
||||
|
||||
use melib::{backends::AccountHash, log, text_processing::TextProcessing, Card, CardId, Draft};
|
||||
use melib::{backends::AccountHash, text::TextProcessing, Card, CardId, Draft};
|
||||
|
||||
use crate::{
|
||||
conf, contacts::editor::ContactManager, shortcut, terminal::*, Action::Tab, Component,
|
||||
|
@ -29,10 +29,10 @@ use crate::{
|
|||
ShortcutMaps, Shortcuts, StatusEvent, TabAction, ThemeAttribute, UIEvent, UIMode,
|
||||
};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
#[derive(Debug)]
|
||||
enum ViewMode {
|
||||
List,
|
||||
View(ComponentId),
|
||||
View(Box<ContactManager>),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -66,7 +66,6 @@ pub struct ContactList {
|
|||
menu_visibility: bool,
|
||||
movement: Option<PageMovement>,
|
||||
cmd_buf: String,
|
||||
view: Option<ContactManager>,
|
||||
ratio: usize, // right/(container width) * 100
|
||||
id: ComponentId,
|
||||
}
|
||||
|
@ -89,7 +88,7 @@ impl ContactList {
|
|||
index: i,
|
||||
})
|
||||
.collect();
|
||||
ContactList {
|
||||
Self {
|
||||
accounts,
|
||||
cursor_pos: 0,
|
||||
new_cursor_pos: 0,
|
||||
|
@ -104,7 +103,6 @@ impl ContactList {
|
|||
dirty: true,
|
||||
movement: None,
|
||||
cmd_buf: String::with_capacity(8),
|
||||
view: None,
|
||||
ratio: 90,
|
||||
sidebar_divider: context.settings.listing.sidebar_divider,
|
||||
sidebar_divider_theme: conf::value(context, "mail.sidebar_divider"),
|
||||
|
@ -114,13 +112,14 @@ impl ContactList {
|
|||
}
|
||||
|
||||
pub fn for_account(pos: usize, context: &Context) -> Self {
|
||||
ContactList {
|
||||
Self {
|
||||
account_pos: pos,
|
||||
..Self::new(context)
|
||||
}
|
||||
}
|
||||
|
||||
fn initialize(&mut self, context: &mut Context) {
|
||||
fn initialize(&mut self, context: &Context) {
|
||||
self.data_columns.clear();
|
||||
let account = &context.accounts[self.account_pos];
|
||||
let book = &account.address_book;
|
||||
self.length = book.len();
|
||||
|
@ -134,25 +133,34 @@ impl ContactList {
|
|||
|
||||
for c in book.values() {
|
||||
/* name */
|
||||
min_width.0 = cmp::max(min_width.0, c.name().split_graphemes().len());
|
||||
let name = c.name().split_graphemes().len();
|
||||
if name > 0 {
|
||||
min_width.0 = cmp::max(min_width.0, name + 1);
|
||||
}
|
||||
/* email */
|
||||
min_width.1 = cmp::max(min_width.1, c.email().split_graphemes().len());
|
||||
let email = c.email().split_graphemes().len();
|
||||
if email > 0 {
|
||||
min_width.1 = cmp::max(min_width.1, email + 1);
|
||||
}
|
||||
/* url */
|
||||
min_width.2 = cmp::max(min_width.2, c.url().split_graphemes().len());
|
||||
let url = c.url().split_graphemes().len();
|
||||
if url > 0 {
|
||||
min_width.2 = cmp::max(min_width.2, url + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* name column */
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(min_width.0, self.length, None, context);
|
||||
_ = self.data_columns.columns[0].resize_with_context(min_width.0, self.length, context);
|
||||
/* email column */
|
||||
self.data_columns.columns[1] =
|
||||
CellBuffer::new_with_context(min_width.1, self.length, None, context);
|
||||
_ = self.data_columns.columns[1].resize_with_context(min_width.1, self.length, context);
|
||||
/* url column */
|
||||
self.data_columns.columns[2] =
|
||||
CellBuffer::new_with_context(min_width.2, self.length, None, context);
|
||||
_ = self.data_columns.columns[2].resize_with_context(min_width.2, self.length, context);
|
||||
/* source column */
|
||||
self.data_columns.columns[3] =
|
||||
CellBuffer::new_with_context("external".len(), self.length, None, context);
|
||||
_ = self.data_columns.columns[3].resize_with_context(
|
||||
"external".len(),
|
||||
self.length,
|
||||
context,
|
||||
);
|
||||
|
||||
let account = &context.accounts[self.account_pos];
|
||||
let book = &account.address_book;
|
||||
|
@ -161,64 +169,73 @@ impl ContactList {
|
|||
for (idx, c) in book_values.iter().enumerate() {
|
||||
self.id_positions.push(*c.id());
|
||||
|
||||
write_string_to_grid(
|
||||
c.name(),
|
||||
&mut self.data_columns.columns[0],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (min_width.0, idx)),
|
||||
None,
|
||||
);
|
||||
{
|
||||
let area = self.data_columns.columns[0].area().nth_row(idx);
|
||||
self.data_columns.columns[0].grid_mut().write_string(
|
||||
c.name(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
)
|
||||
};
|
||||
|
||||
write_string_to_grid(
|
||||
c.email(),
|
||||
&mut self.data_columns.columns[1],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (min_width.1, idx)),
|
||||
None,
|
||||
);
|
||||
{
|
||||
let area = self.data_columns.columns[1].area().nth_row(idx);
|
||||
self.data_columns.columns[1].grid_mut().write_string(
|
||||
c.email(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
)
|
||||
};
|
||||
|
||||
write_string_to_grid(
|
||||
c.url(),
|
||||
&mut self.data_columns.columns[2],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (min_width.2, idx)),
|
||||
None,
|
||||
);
|
||||
{
|
||||
let area = self.data_columns.columns[2].area().nth_row(idx);
|
||||
self.data_columns.columns[2].grid_mut().write_string(
|
||||
c.url(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
)
|
||||
};
|
||||
|
||||
write_string_to_grid(
|
||||
if c.external_resource() {
|
||||
"external"
|
||||
} else {
|
||||
"local"
|
||||
},
|
||||
&mut self.data_columns.columns[3],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (min_width.3, idx)),
|
||||
None,
|
||||
);
|
||||
{
|
||||
let area = self.data_columns.columns[3].area().nth_row(idx);
|
||||
self.data_columns.columns[3].grid_mut().write_string(
|
||||
if c.external_resource() {
|
||||
"external"
|
||||
} else {
|
||||
"local"
|
||||
},
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
if self.length == 0 {
|
||||
let message = "Address book is empty.".to_string();
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), self.length, None, context);
|
||||
write_string_to_grid(
|
||||
&message,
|
||||
&mut self.data_columns.columns[0],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, 0), (message.len() - 1, 0)),
|
||||
None,
|
||||
);
|
||||
if self.data_columns.columns[0].resize_with_context(message.len(), self.length, context)
|
||||
{
|
||||
let area = self.data_columns.columns[0].area();
|
||||
self.data_columns.columns[0].grid_mut().write_string(
|
||||
&message,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,25 +250,22 @@ impl ContactList {
|
|||
if !grid.use_color {
|
||||
theme.attrs |= Attr::REVERSE;
|
||||
}
|
||||
change_theme(grid, area, theme);
|
||||
grid.change_theme(area, theme);
|
||||
}
|
||||
|
||||
fn draw_menu(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
if !self.is_dirty() {
|
||||
return;
|
||||
}
|
||||
clear_area(grid, area, self.theme_default);
|
||||
let upper_left = upper_left!(area);
|
||||
let bottom_right = bottom_right!(area);
|
||||
grid.clear_area(area, self.theme_default);
|
||||
self.dirty = false;
|
||||
let mut y = get_y(upper_left);
|
||||
for a in &self.accounts {
|
||||
self.print_account(grid, (set_y(upper_left, y), bottom_right), a, context);
|
||||
y += 1;
|
||||
for (y, a) in self.accounts.iter().enumerate() {
|
||||
self.print_account(grid, area.nth_row(y), a, context);
|
||||
}
|
||||
|
||||
context.dirty_areas.push_back(area);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a single account in the menu area.
|
||||
*/
|
||||
|
@ -260,13 +274,9 @@ impl ContactList {
|
|||
grid: &mut CellBuffer,
|
||||
area: Area,
|
||||
a: &AccountMenuEntry,
|
||||
context: &mut Context,
|
||||
context: &Context,
|
||||
) {
|
||||
if !is_valid_area!(area) {
|
||||
log::debug!("BUG: invalid area in print_account");
|
||||
}
|
||||
|
||||
let width = width!(area);
|
||||
let width = area.width();
|
||||
let must_highlight_account: bool = self.account_pos == a.index;
|
||||
let account_attrs = if must_highlight_account {
|
||||
let mut v = crate::conf::value(context, "mail.sidebar_highlighted");
|
||||
|
@ -278,109 +288,55 @@ impl ContactList {
|
|||
crate::conf::value(context, "mail.sidebar_account_name")
|
||||
};
|
||||
|
||||
grid.change_theme(area, account_attrs);
|
||||
let s = format!(" [{}]", context.accounts[a.index].address_book.len());
|
||||
/* Print account name */
|
||||
grid.write_string(
|
||||
&a.name,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
account_attrs.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
grid.write_string(
|
||||
&s,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
account_attrs.attrs,
|
||||
area.skip_cols(area.width().saturating_sub(s.len())),
|
||||
None,
|
||||
);
|
||||
|
||||
if a.name.grapheme_len() + s.len() > width + 1 {
|
||||
/* Print account name */
|
||||
let (x, y) = write_string_to_grid(
|
||||
&a.name,
|
||||
grid,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
account_attrs.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
write_string_to_grid(
|
||||
&s,
|
||||
grid,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
account_attrs.attrs,
|
||||
(
|
||||
pos_dec(
|
||||
(get_x(bottom_right!(area)), get_y(upper_left!(area))),
|
||||
(s.len() - 1, 0),
|
||||
),
|
||||
bottom_right!(area),
|
||||
),
|
||||
None,
|
||||
);
|
||||
write_string_to_grid(
|
||||
grid.write_string(
|
||||
"ā¦",
|
||||
grid,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
account_attrs.attrs,
|
||||
(
|
||||
pos_dec(
|
||||
(get_x(bottom_right!(area)), get_y(upper_left!(area))),
|
||||
(s.len() - 1, 0),
|
||||
),
|
||||
bottom_right!(area),
|
||||
),
|
||||
area.skip_cols(area.width().saturating_sub(s.len() + 1)),
|
||||
None,
|
||||
);
|
||||
|
||||
for x in x..=get_x(bottom_right!(area)) {
|
||||
grid[(x, y)]
|
||||
.set_fg(account_attrs.fg)
|
||||
.set_bg(account_attrs.bg)
|
||||
.set_attrs(account_attrs.attrs);
|
||||
}
|
||||
} else {
|
||||
/* Print account name */
|
||||
|
||||
let (x, y) = write_string_to_grid(
|
||||
&a.name,
|
||||
grid,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
account_attrs.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
write_string_to_grid(
|
||||
&s,
|
||||
grid,
|
||||
account_attrs.fg,
|
||||
account_attrs.bg,
|
||||
account_attrs.attrs,
|
||||
(
|
||||
pos_dec(
|
||||
(get_x(bottom_right!(area)), get_y(upper_left!(area))),
|
||||
(s.len() - 1, 0),
|
||||
),
|
||||
bottom_right!(area),
|
||||
),
|
||||
None,
|
||||
);
|
||||
for x in x..=get_x(bottom_right!(area)) {
|
||||
grid[(x, y)]
|
||||
.set_fg(account_attrs.fg)
|
||||
.set_bg(account_attrs.bg)
|
||||
.set_attrs(account_attrs.attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_list(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
let total_area = area;
|
||||
/* reserve top row for column headers */
|
||||
let upper_left = pos_inc(upper_left!(area), (0, 1));
|
||||
let bottom_right = bottom_right!(area);
|
||||
|
||||
let header_area = area.nth_row(0);
|
||||
let area = area.skip_rows(1);
|
||||
if self.length == 0 {
|
||||
clear_area(grid, area, self.theme_default);
|
||||
copy_area(
|
||||
grid,
|
||||
&self.data_columns.columns[0],
|
||||
grid.clear_area(area, self.theme_default);
|
||||
|
||||
grid.copy_area(
|
||||
self.data_columns.columns[0].grid(),
|
||||
area,
|
||||
((0, 0), pos_dec(self.data_columns.columns[0].size(), (1, 1))),
|
||||
self.data_columns.columns[0].area(),
|
||||
);
|
||||
context.dirty_areas.push_back(area);
|
||||
context.dirty_areas.push_back(total_area);
|
||||
return;
|
||||
}
|
||||
let rows = get_y(bottom_right) - get_y(upper_left) + 1;
|
||||
let rows = area.height();
|
||||
|
||||
if let Some(mvm) = self.movement.take() {
|
||||
match mvm {
|
||||
|
@ -429,7 +385,7 @@ impl ContactList {
|
|||
ScrollUpdate::Update {
|
||||
id: self.id,
|
||||
context: ScrollContext {
|
||||
shown_lines: top_idx + rows,
|
||||
shown_lines: (top_idx + rows).min(self.length - top_idx),
|
||||
total_lines: self.length,
|
||||
has_more_lines: false,
|
||||
},
|
||||
|
@ -450,12 +406,9 @@ impl ContactList {
|
|||
self.cursor_pos = self.new_cursor_pos;
|
||||
for idx in &[old_cursor_pos, self.new_cursor_pos] {
|
||||
if *idx >= self.length {
|
||||
continue; //bounds check
|
||||
continue;
|
||||
}
|
||||
let new_area = (
|
||||
set_y(upper_left, get_y(upper_left) + (*idx % rows)),
|
||||
set_y(bottom_right, get_y(upper_left) + (*idx % rows)),
|
||||
);
|
||||
let new_area = area.nth_row(*idx % rows);
|
||||
self.highlight_line(grid, new_area, *idx);
|
||||
context.dirty_areas.push_back(new_area);
|
||||
}
|
||||
|
@ -468,34 +421,20 @@ impl ContactList {
|
|||
self.cursor_pos = self.new_cursor_pos;
|
||||
}
|
||||
|
||||
let width = width!(area);
|
||||
self.data_columns.widths = Default::default();
|
||||
self.data_columns.widths[0] = self.data_columns.columns[0].size().0; /* name */
|
||||
self.data_columns.widths[1] = self.data_columns.columns[1].size().0; /* email */
|
||||
self.data_columns.widths[2] = self.data_columns.columns[2].size().0; /* url */
|
||||
self.data_columns.widths[3] = self.data_columns.columns[3].size().0; /* source */
|
||||
|
||||
let min_col_width = std::cmp::min(
|
||||
15,
|
||||
std::cmp::min(self.data_columns.widths[0], self.data_columns.widths[1]),
|
||||
);
|
||||
if self.data_columns.widths[0] + self.data_columns.widths[1] + 3 * min_col_width + 8 > width
|
||||
{
|
||||
let remainder =
|
||||
width.saturating_sub(self.data_columns.widths[0] + self.data_columns.widths[1] + 4);
|
||||
self.data_columns.widths[2] = remainder / 6;
|
||||
}
|
||||
clear_area(grid, area, self.theme_default);
|
||||
/* Page_no has changed, so draw new page */
|
||||
grid.clear_area(total_area, self.theme_default);
|
||||
_ = self.data_columns.recalc_widths(area.size(), top_idx);
|
||||
/* copy table columns */
|
||||
self.data_columns
|
||||
.draw(grid, top_idx, self.cursor_pos, grid.bounds_iter(area));
|
||||
|
||||
let header_attrs = crate::conf::value(context, "widgets.list.header");
|
||||
let mut x = get_x(upper_left);
|
||||
let mut x = 0;
|
||||
for i in 0..self.data_columns.columns.len() {
|
||||
if self.data_columns.widths[i] == 0 {
|
||||
continue;
|
||||
}
|
||||
let (column_width, column_height) = self.data_columns.columns[i].size();
|
||||
write_string_to_grid(
|
||||
grid.write_string(
|
||||
match i {
|
||||
0 => "NAME",
|
||||
1 => "E-MAIL",
|
||||
|
@ -503,77 +442,37 @@ impl ContactList {
|
|||
3 => "SOURCE",
|
||||
_ => "",
|
||||
},
|
||||
grid,
|
||||
header_attrs.fg,
|
||||
header_attrs.bg,
|
||||
header_attrs.attrs,
|
||||
(
|
||||
set_x(upper_left!(area), x),
|
||||
(
|
||||
std::cmp::min(get_x(bottom_right), x + (self.data_columns.widths[i])),
|
||||
get_y(upper_left!(area)),
|
||||
),
|
||||
),
|
||||
header_area
|
||||
.skip_cols(x)
|
||||
.take_cols(x + (self.data_columns.widths[i])),
|
||||
None,
|
||||
);
|
||||
copy_area(
|
||||
grid,
|
||||
&self.data_columns.columns[i],
|
||||
(
|
||||
set_x(upper_left, x),
|
||||
set_x(
|
||||
bottom_right,
|
||||
std::cmp::min(get_x(bottom_right), x + (self.data_columns.widths[i])),
|
||||
),
|
||||
),
|
||||
(
|
||||
(0, top_idx),
|
||||
(
|
||||
column_width.saturating_sub(1),
|
||||
column_height.saturating_sub(1),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
x += self.data_columns.widths[i] + 2; // + SEPARATOR
|
||||
if x > get_x(bottom_right) {
|
||||
if x > header_area.width() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
change_theme(
|
||||
grid,
|
||||
(
|
||||
upper_left!(area),
|
||||
set_y(bottom_right, get_y(upper_left!(area))),
|
||||
),
|
||||
header_attrs,
|
||||
);
|
||||
grid.change_theme(header_area, header_attrs);
|
||||
|
||||
if top_idx + rows > self.length {
|
||||
clear_area(
|
||||
grid,
|
||||
(
|
||||
pos_inc(upper_left, (0, self.length - top_idx + 2)),
|
||||
bottom_right,
|
||||
),
|
||||
grid.clear_area(
|
||||
area.skip_rows(top_idx + rows - self.length.saturating_sub(1)),
|
||||
self.theme_default,
|
||||
);
|
||||
}
|
||||
self.highlight_line(
|
||||
grid,
|
||||
(
|
||||
set_y(upper_left, get_y(upper_left) + (self.cursor_pos % rows)),
|
||||
set_y(bottom_right, get_y(upper_left) + (self.cursor_pos % rows)),
|
||||
),
|
||||
self.cursor_pos,
|
||||
);
|
||||
context.dirty_areas.push_back(area);
|
||||
self.highlight_line(grid, area.nth_row(self.cursor_pos % rows), self.cursor_pos);
|
||||
context.dirty_areas.push_back(total_area);
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for ContactList {
|
||||
fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
if let Some(mgr) = self.view.as_mut() {
|
||||
if let ViewMode::View(ref mut mgr) = self.mode {
|
||||
mgr.draw(grid, area, context);
|
||||
return;
|
||||
}
|
||||
|
@ -585,27 +484,26 @@ impl Component for ContactList {
|
|||
self.initialize(context);
|
||||
}
|
||||
|
||||
let upper_left = upper_left!(area);
|
||||
let bottom_right = bottom_right!(area);
|
||||
let total_cols = get_x(bottom_right) - get_x(upper_left);
|
||||
let total_cols = area.width();
|
||||
|
||||
let right_component_width = if self.menu_visibility {
|
||||
(self.ratio * total_cols) / 100
|
||||
} else {
|
||||
total_cols
|
||||
};
|
||||
let mid = get_x(bottom_right) - right_component_width;
|
||||
if self.dirty && mid != get_x(upper_left) {
|
||||
for i in get_y(upper_left)..=get_y(bottom_right) {
|
||||
grid[(mid, i)]
|
||||
.set_ch(self.sidebar_divider)
|
||||
.set_fg(self.sidebar_divider_theme.fg)
|
||||
.set_bg(self.sidebar_divider_theme.bg)
|
||||
.set_attrs(self.sidebar_divider_theme.attrs);
|
||||
let mid = area.width().saturating_sub(right_component_width);
|
||||
if self.dirty && mid != 0 {
|
||||
let divider_area = area.nth_col(mid);
|
||||
for row in grid.bounds_iter(divider_area) {
|
||||
for c in row {
|
||||
grid[c]
|
||||
.set_ch(self.sidebar_divider)
|
||||
.set_fg(self.sidebar_divider_theme.fg)
|
||||
.set_bg(self.sidebar_divider_theme.bg)
|
||||
.set_attrs(self.sidebar_divider_theme.attrs);
|
||||
}
|
||||
}
|
||||
context
|
||||
.dirty_areas
|
||||
.push_back(((mid, get_y(upper_left)), (mid, get_y(bottom_right))));
|
||||
context.dirty_areas.push_back(divider_area);
|
||||
}
|
||||
|
||||
if right_component_width == total_cols {
|
||||
|
@ -613,18 +511,18 @@ impl Component for ContactList {
|
|||
} else if right_component_width == 0 {
|
||||
self.draw_menu(grid, area, context);
|
||||
} else {
|
||||
self.draw_menu(
|
||||
grid,
|
||||
(upper_left, (mid.saturating_sub(1), get_y(bottom_right))),
|
||||
context,
|
||||
);
|
||||
self.draw_list(grid, (set_x(upper_left, mid + 1), bottom_right), context);
|
||||
self.draw_menu(grid, area.take_cols(mid), context);
|
||||
self.draw_list(grid, area.skip_cols(mid + 1), context);
|
||||
}
|
||||
self.dirty = false;
|
||||
}
|
||||
|
||||
fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool {
|
||||
match event {
|
||||
UIEvent::VisibilityChange(true) => {
|
||||
self.initialized = false;
|
||||
self.set_dirty(true);
|
||||
}
|
||||
UIEvent::ConfigReload { old_settings: _ } => {
|
||||
self.theme_default = crate::conf::value(context, "theme_default");
|
||||
self.initialized = false;
|
||||
|
@ -636,12 +534,6 @@ impl Component for ContactList {
|
|||
self.initialized = false;
|
||||
self.set_dirty(true);
|
||||
}
|
||||
UIEvent::ComponentUnrealize(ref kill_id) if self.mode == ViewMode::View(*kill_id) => {
|
||||
self.mode = ViewMode::List;
|
||||
self.view.take();
|
||||
self.set_dirty(true);
|
||||
return true;
|
||||
}
|
||||
UIEvent::ChangeMode(UIMode::Normal) => {
|
||||
self.set_dirty(true);
|
||||
}
|
||||
|
@ -651,30 +543,34 @@ impl Component for ContactList {
|
|||
_ => {}
|
||||
}
|
||||
|
||||
if let Some(ref mut v) = self.view {
|
||||
if v.process_event(event, context) {
|
||||
if let ViewMode::View(ref mut mgr) = self.mode {
|
||||
if matches!(event, UIEvent::ComponentUnrealize(id) if *id == mgr.id()) {
|
||||
mgr.unrealize(context);
|
||||
self.mode = ViewMode::List;
|
||||
self.set_dirty(true);
|
||||
return true;
|
||||
}
|
||||
if mgr.process_event(event, context) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
let shortcuts = self.shortcuts(context);
|
||||
if self.view.is_none() {
|
||||
if matches!(self.mode, ViewMode::List) {
|
||||
match *event {
|
||||
UIEvent::Input(ref key)
|
||||
if shortcut!(key == shortcuts[Shortcuts::CONTACT_LIST]["create_contact"]) =>
|
||||
{
|
||||
let mut manager = ContactManager::new(context);
|
||||
let mut manager = Box::new(ContactManager::new(context));
|
||||
manager.set_parent_id(self.id);
|
||||
manager.account_pos = self.account_pos;
|
||||
|
||||
self.mode = ViewMode::View(manager.id());
|
||||
self.view = Some(manager);
|
||||
self.mode = ViewMode::View(manager);
|
||||
context
|
||||
.replies
|
||||
.push_back(UIEvent::StatusEvent(StatusEvent::ScrollUpdate(
|
||||
ScrollUpdate::End(self.id),
|
||||
)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -687,19 +583,17 @@ impl Component for ContactList {
|
|||
let account = &mut context.accounts[self.account_pos];
|
||||
let book = &mut account.address_book;
|
||||
let card = book[&self.id_positions[self.cursor_pos]].clone();
|
||||
let mut manager = ContactManager::new(context);
|
||||
let mut manager = Box::new(ContactManager::new(context));
|
||||
manager.set_parent_id(self.id);
|
||||
manager.card = card;
|
||||
manager.account_pos = self.account_pos;
|
||||
|
||||
self.mode = ViewMode::View(manager.id());
|
||||
self.view = Some(manager);
|
||||
self.mode = ViewMode::View(manager);
|
||||
context
|
||||
.replies
|
||||
.push_back(UIEvent::StatusEvent(StatusEvent::ScrollUpdate(
|
||||
ScrollUpdate::End(self.id),
|
||||
)));
|
||||
|
||||
return true;
|
||||
}
|
||||
UIEvent::Input(ref key)
|
||||
|
@ -944,6 +838,25 @@ impl Component for ContactList {
|
|||
self.movement = Some(PageMovement::End);
|
||||
return true;
|
||||
}
|
||||
UIEvent::Input(ref key)
|
||||
if context
|
||||
.settings
|
||||
.shortcuts
|
||||
.contact_list
|
||||
.commands
|
||||
.iter()
|
||||
.any(|cmd| {
|
||||
if cmd.shortcut == *key {
|
||||
for cmd in &cmd.command {
|
||||
context.replies.push_back(UIEvent::Command(cmd.to_string()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}) =>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
@ -951,13 +864,13 @@ impl Component for ContactList {
|
|||
}
|
||||
|
||||
fn is_dirty(&self) -> bool {
|
||||
self.dirty || self.view.as_ref().map(|v| v.is_dirty()).unwrap_or(false)
|
||||
self.dirty || matches!(self.mode, ViewMode::View(ref mgr) if mgr.is_dirty())
|
||||
}
|
||||
|
||||
fn set_dirty(&mut self, value: bool) {
|
||||
if let Some(p) = self.view.as_mut() {
|
||||
p.set_dirty(value);
|
||||
};
|
||||
if let ViewMode::View(ref mut mgr) = self.mode {
|
||||
mgr.set_dirty(value);
|
||||
}
|
||||
self.dirty = value;
|
||||
}
|
||||
|
||||
|
@ -967,12 +880,13 @@ impl Component for ContactList {
|
|||
.replies
|
||||
.push_back(UIEvent::Action(Tab(TabAction::Kill(uuid))));
|
||||
}
|
||||
|
||||
fn shortcuts(&self, context: &Context) -> ShortcutMaps {
|
||||
let mut map = self
|
||||
.view
|
||||
.as_ref()
|
||||
.map(|p| p.shortcuts(context))
|
||||
.unwrap_or_default();
|
||||
let mut map = if let ViewMode::View(ref mgr) = self.mode {
|
||||
mgr.shortcuts(context)
|
||||
} else {
|
||||
ShortcutMaps::default()
|
||||
};
|
||||
|
||||
map.insert(
|
||||
Shortcuts::CONTACT_LIST,
|
||||
|
@ -991,10 +905,10 @@ impl Component for ContactList {
|
|||
}
|
||||
|
||||
fn can_quit_cleanly(&mut self, context: &Context) -> bool {
|
||||
self.view
|
||||
.as_mut()
|
||||
.map(|p| p.can_quit_cleanly(context))
|
||||
.unwrap_or(true)
|
||||
if let ViewMode::View(ref mut mgr) = self.mode {
|
||||
return mgr.can_quit_cleanly(context);
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn status(&self, context: &Context) -> String {
|
||||
|
|
|
@ -19,6 +19,5 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pub mod list;
|
||||
|
||||
pub mod editor;
|
||||
pub mod list;
|
||||
|
|
|
@ -110,7 +110,7 @@ pub struct MeliTask {
|
|||
timer: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
/// A spawned future's metadata for book-keeping.
|
||||
pub struct JobMetadata {
|
||||
pub id: JobId,
|
||||
|
@ -176,7 +176,7 @@ impl JobExecutor {
|
|||
/// A queue that holds scheduled tasks.
|
||||
pub fn new(sender: Sender<ThreadEvent>) -> Self {
|
||||
// Create a queue.
|
||||
let mut ret = JobExecutor {
|
||||
let mut ret = Self {
|
||||
global_queue: Arc::new(Injector::new()),
|
||||
workers: vec![],
|
||||
parkers: vec![],
|
||||
|
@ -185,7 +185,10 @@ impl JobExecutor {
|
|||
jobs: Arc::new(Mutex::new(IndexMap::default())),
|
||||
};
|
||||
let mut workers = vec![];
|
||||
for _ in 0..num_cpus::get().max(1) {
|
||||
for _ in 0..std::thread::available_parallelism()
|
||||
.map(Into::into)
|
||||
.unwrap_or(1)
|
||||
{
|
||||
let new_worker = Worker::new_fifo();
|
||||
ret.workers.push(new_worker.stealer());
|
||||
let p = Parker::new();
|
||||
|
@ -234,6 +237,7 @@ impl JobExecutor {
|
|||
}
|
||||
|
||||
/// Spawns a future with a generic return value `R`
|
||||
#[inline(always)]
|
||||
pub fn spawn_specialized<F, R>(&self, desc: Cow<'static, str>, future: F) -> JoinHandle<R>
|
||||
where
|
||||
F: Future<Output = R> + Send + 'static,
|
||||
|
@ -295,6 +299,7 @@ impl JobExecutor {
|
|||
|
||||
/// Spawns a future with a generic return value `R` that might block on a
|
||||
/// new thread
|
||||
#[inline(always)]
|
||||
pub fn spawn_blocking<F, R>(&self, desc: Cow<'static, str>, future: F) -> JoinHandle<R>
|
||||
where
|
||||
F: Future<Output = R> + Send + 'static,
|
||||
|
@ -306,7 +311,7 @@ impl JobExecutor {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn create_timer(self: Arc<JobExecutor>, interval: Duration, value: Duration) -> Timer {
|
||||
pub fn create_timer(self: Arc<Self>, interval: Duration, value: Duration) -> Timer {
|
||||
let timer = TimerPrivate {
|
||||
interval,
|
||||
cancel: Arc::new(Mutex::new(false)),
|
||||
|
@ -415,7 +420,7 @@ impl JobExecutor {
|
|||
|
||||
pub type JobChannel<T> = oneshot::Receiver<T>;
|
||||
|
||||
/// JoinHandle for the future that allows us to cancel the task.
|
||||
/// `JoinHandle` for the future that allows us to cancel the task.
|
||||
#[derive(Debug)]
|
||||
pub struct JoinHandle<T> {
|
||||
pub task: Arc<Mutex<Option<async_task::Task<()>>>>,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use std::{borrow::Cow, cmp};
|
||||
use std::borrow::Cow;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
|
@ -32,7 +32,7 @@ use crate::{
|
|||
},
|
||||
};
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[repr(u8)]
|
||||
enum Column {
|
||||
_0 = 0,
|
||||
|
@ -78,7 +78,7 @@ impl std::fmt::Display for JobManager {
|
|||
}
|
||||
|
||||
impl JobManager {
|
||||
const HEADERS: [&str; 5] = ["id", "desc", "started", "finished", "succeeded"];
|
||||
const HEADERS: [&'static str; 5] = ["id", "desc", "started", "finished", "succeeded"];
|
||||
|
||||
pub fn new(context: &Context) -> Self {
|
||||
let theme_default = crate::conf::value(context, "theme_default");
|
||||
|
@ -110,7 +110,7 @@ impl JobManager {
|
|||
}
|
||||
}
|
||||
|
||||
fn initialize(&mut self, context: &mut Context) {
|
||||
fn initialize(&mut self, context: &Context) {
|
||||
self.set_dirty(true);
|
||||
|
||||
let mut entries = (*context.main_loop_handler.job_executor.jobs.lock().unwrap()).clone();
|
||||
|
@ -146,124 +146,160 @@ impl JobManager {
|
|||
self.min_width = [hdr!(0), hdr!(1), hdr!(2), hdr!(3), hdr!(4)];
|
||||
|
||||
for c in self.entries.values() {
|
||||
/* title */
|
||||
self.min_width[0] = cmp::max(self.min_width[0], c.id.to_string().len());
|
||||
/* desc */
|
||||
self.min_width[1] = cmp::max(self.min_width[1], c.desc.len());
|
||||
// title
|
||||
self.min_width[0] = self.min_width[0].max(c.id.to_string().len());
|
||||
// desc
|
||||
self.min_width[1] = self.min_width[1].max(c.desc.len());
|
||||
}
|
||||
self.min_width[2] = "1970-01-01 00:00:00".len();
|
||||
self.min_width[3] = self.min_width[2];
|
||||
|
||||
/* name column */
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(self.min_width[0], self.length, None, context);
|
||||
/* path column */
|
||||
self.data_columns.columns[1] =
|
||||
CellBuffer::new_with_context(self.min_width[1], self.length, None, context);
|
||||
/* size column */
|
||||
self.data_columns.columns[2] =
|
||||
CellBuffer::new_with_context(self.min_width[2], self.length, None, context);
|
||||
/* subscribed column */
|
||||
self.data_columns.columns[3] =
|
||||
CellBuffer::new_with_context(self.min_width[3], self.length, None, context);
|
||||
self.data_columns.columns[4] =
|
||||
CellBuffer::new_with_context(self.min_width[4], self.length, None, context);
|
||||
// name column
|
||||
_ = self.data_columns.columns[0].resize_with_context(
|
||||
self.min_width[0],
|
||||
self.length,
|
||||
context,
|
||||
);
|
||||
self.data_columns.columns[0].grid_mut().clear(None);
|
||||
// path column
|
||||
_ = self.data_columns.columns[1].resize_with_context(
|
||||
self.min_width[1],
|
||||
self.length,
|
||||
context,
|
||||
);
|
||||
self.data_columns.columns[1].grid_mut().clear(None);
|
||||
// size column
|
||||
_ = self.data_columns.columns[2].resize_with_context(
|
||||
self.min_width[2],
|
||||
self.length,
|
||||
context,
|
||||
);
|
||||
self.data_columns.columns[2].grid_mut().clear(None);
|
||||
// subscribed column
|
||||
_ = self.data_columns.columns[3].resize_with_context(
|
||||
self.min_width[3],
|
||||
self.length,
|
||||
context,
|
||||
);
|
||||
self.data_columns.columns[3].grid_mut().clear(None);
|
||||
_ = self.data_columns.columns[4].resize_with_context(
|
||||
self.min_width[4],
|
||||
self.length,
|
||||
context,
|
||||
);
|
||||
self.data_columns.columns[4].grid_mut().clear(None);
|
||||
|
||||
for (idx, e) in self.entries.values().enumerate() {
|
||||
write_string_to_grid(
|
||||
&e.id.to_string(),
|
||||
&mut self.data_columns.columns[0],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (self.min_width[0], idx)),
|
||||
None,
|
||||
);
|
||||
{
|
||||
let area = self.data_columns.columns[0].area().nth_row(idx);
|
||||
self.data_columns.columns[0].grid_mut().write_string(
|
||||
&e.id.to_string(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
write_string_to_grid(
|
||||
&e.desc,
|
||||
&mut self.data_columns.columns[1],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (self.min_width[1], idx)),
|
||||
None,
|
||||
);
|
||||
{
|
||||
let area = self.data_columns.columns[1].area().nth_row(idx);
|
||||
self.data_columns.columns[1].grid_mut().write_string(
|
||||
&e.desc,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
write_string_to_grid(
|
||||
&datetime::timestamp_to_string(e.started, Some(RFC3339_DATETIME_AND_SPACE), true),
|
||||
&mut self.data_columns.columns[2],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (self.min_width[2], idx)),
|
||||
None,
|
||||
);
|
||||
|
||||
write_string_to_grid(
|
||||
&if let Some(t) = e.finished {
|
||||
Cow::Owned(datetime::timestamp_to_string(
|
||||
t,
|
||||
{
|
||||
let area = self.data_columns.columns[2].area().nth_row(idx);
|
||||
self.data_columns.columns[2].grid_mut().write_string(
|
||||
&datetime::timestamp_to_string(
|
||||
e.started,
|
||||
Some(RFC3339_DATETIME_AND_SPACE),
|
||||
true,
|
||||
))
|
||||
} else {
|
||||
Cow::Borrowed("null")
|
||||
},
|
||||
&mut self.data_columns.columns[3],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (self.min_width[3], idx)),
|
||||
None,
|
||||
);
|
||||
),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
write_string_to_grid(
|
||||
&if e.finished.is_some() {
|
||||
Cow::Owned(format!("{:?}", e.succeeded))
|
||||
} else {
|
||||
Cow::Borrowed("-")
|
||||
},
|
||||
&mut self.data_columns.columns[4],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (self.min_width[4], idx)),
|
||||
None,
|
||||
);
|
||||
{
|
||||
let area = self.data_columns.columns[3].area().nth_row(idx);
|
||||
self.data_columns.columns[3].grid_mut().write_string(
|
||||
&if let Some(t) = e.finished {
|
||||
Cow::Owned(datetime::timestamp_to_string(
|
||||
t,
|
||||
Some(RFC3339_DATETIME_AND_SPACE),
|
||||
true,
|
||||
))
|
||||
} else {
|
||||
Cow::Borrowed("null")
|
||||
},
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
let area = self.data_columns.columns[4].area().nth_row(idx);
|
||||
self.data_columns.columns[4].grid_mut().write_string(
|
||||
&if e.finished.is_some() {
|
||||
Cow::Owned(format!("{:?}", e.succeeded))
|
||||
} else {
|
||||
Cow::Borrowed("-")
|
||||
},
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if self.length == 0 {
|
||||
let message = "No jobs.".to_string();
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), self.length, None, context);
|
||||
write_string_to_grid(
|
||||
&message,
|
||||
&mut self.data_columns.columns[0],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, 0), (message.len() - 1, 0)),
|
||||
None,
|
||||
);
|
||||
if self.data_columns.columns[0].resize_with_context(message.len(), self.length, context)
|
||||
{
|
||||
let area = self.data_columns.columns[0].area();
|
||||
self.data_columns.columns[0].grid_mut().write_string(
|
||||
&message,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_list(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
let (upper_left, bottom_right) = area;
|
||||
|
||||
let rows = area.height();
|
||||
if rows == 0 {
|
||||
return;
|
||||
}
|
||||
if self.length == 0 {
|
||||
clear_area(grid, area, self.theme_default);
|
||||
copy_area(
|
||||
grid,
|
||||
&self.data_columns.columns[0],
|
||||
grid.clear_area(area, self.theme_default);
|
||||
|
||||
grid.copy_area(
|
||||
self.data_columns.columns[0].grid(),
|
||||
area,
|
||||
((0, 0), pos_dec(self.data_columns.columns[0].size(), (1, 1))),
|
||||
self.data_columns.columns[0].area(),
|
||||
);
|
||||
context.dirty_areas.push_back(area);
|
||||
return;
|
||||
}
|
||||
let rows = get_y(bottom_right) - get_y(upper_left) + 1;
|
||||
|
||||
if let Some(mvm) = self.movement.take() {
|
||||
match mvm {
|
||||
|
@ -290,7 +326,20 @@ impl JobManager {
|
|||
self.new_cursor_pos = (self.length / rows) * rows;
|
||||
}
|
||||
}
|
||||
PageMovement::Right(_) | PageMovement::Left(_) => {}
|
||||
PageMovement::Right(amount) => {
|
||||
self.data_columns.x_offset += amount;
|
||||
self.data_columns.x_offset = self.data_columns.x_offset.min(
|
||||
self.data_columns
|
||||
.widths
|
||||
.iter()
|
||||
.map(|w| w + 2)
|
||||
.sum::<usize>()
|
||||
.saturating_sub(2),
|
||||
);
|
||||
}
|
||||
PageMovement::Left(amount) => {
|
||||
self.data_columns.x_offset = self.data_columns.x_offset.saturating_sub(amount);
|
||||
}
|
||||
PageMovement::Home => {
|
||||
self.new_cursor_pos = 0;
|
||||
}
|
||||
|
@ -326,8 +375,8 @@ impl JobManager {
|
|||
)));
|
||||
}
|
||||
|
||||
/* If cursor position has changed, remove the highlight from the previous
|
||||
* position and apply it in the new one. */
|
||||
// If cursor position has changed, remove the highlight from the previous
|
||||
// position and apply it in the new one.
|
||||
if self.cursor_pos != self.new_cursor_pos && prev_page_no == page_no {
|
||||
let old_cursor_pos = self.cursor_pos;
|
||||
self.cursor_pos = self.new_cursor_pos;
|
||||
|
@ -335,7 +384,7 @@ impl JobManager {
|
|||
if idx >= self.length {
|
||||
continue; //bounds check
|
||||
}
|
||||
let new_area = nth_row_area(area, idx % rows);
|
||||
let new_area = area.nth_row(idx % rows);
|
||||
self.data_columns
|
||||
.draw(grid, idx, self.cursor_pos, grid.bounds_iter(new_area));
|
||||
let row_attr = if highlight {
|
||||
|
@ -343,7 +392,7 @@ impl JobManager {
|
|||
} else {
|
||||
self.theme_default
|
||||
};
|
||||
change_theme(grid, new_area, row_attr);
|
||||
grid.change_theme(new_area, row_attr);
|
||||
context.dirty_areas.push_back(new_area);
|
||||
}
|
||||
return;
|
||||
|
@ -354,32 +403,21 @@ impl JobManager {
|
|||
self.new_cursor_pos = self.length - 1;
|
||||
self.cursor_pos = self.new_cursor_pos;
|
||||
}
|
||||
/* Page_no has changed, so draw new page */
|
||||
// Page_no has changed, so draw new page
|
||||
_ = self
|
||||
.data_columns
|
||||
.recalc_widths((width!(area), height!(area)), top_idx);
|
||||
clear_area(grid, area, self.theme_default);
|
||||
/* copy table columns */
|
||||
.recalc_widths((area.width(), area.height()), top_idx);
|
||||
grid.clear_area(area, self.theme_default);
|
||||
// copy table columns
|
||||
self.data_columns
|
||||
.draw(grid, top_idx, self.cursor_pos, grid.bounds_iter(area));
|
||||
|
||||
/* highlight cursor */
|
||||
change_theme(
|
||||
grid,
|
||||
nth_row_area(area, self.cursor_pos % rows),
|
||||
self.highlight_theme,
|
||||
);
|
||||
// highlight cursor
|
||||
grid.change_theme(area.nth_row(self.cursor_pos % rows), self.highlight_theme);
|
||||
|
||||
/* clear gap if available height is more than count of entries */
|
||||
// clear gap if available height is more than count of entries
|
||||
if top_idx + rows > self.length {
|
||||
clear_area(
|
||||
grid,
|
||||
(
|
||||
pos_inc(upper_left, (0, self.length - top_idx)),
|
||||
bottom_right,
|
||||
),
|
||||
self.theme_default,
|
||||
);
|
||||
grid.change_theme(area.skip_rows(self.length - top_idx), self.theme_default);
|
||||
}
|
||||
context.dirty_areas.push_back(area);
|
||||
}
|
||||
|
@ -393,20 +431,18 @@ impl Component for JobManager {
|
|||
if !self.initialized {
|
||||
self.initialize(context);
|
||||
}
|
||||
{
|
||||
if self.dirty {
|
||||
let area = area.nth_row(0);
|
||||
// Draw column headers.
|
||||
let area = nth_row_area(area, 0);
|
||||
clear_area(grid, area, self.theme_default);
|
||||
grid.clear_area(area, self.theme_default);
|
||||
let mut x_offset = 0;
|
||||
let (upper_left, bottom_right) = area;
|
||||
for (i, (h, w)) in Self::HEADERS.iter().zip(self.min_width).enumerate() {
|
||||
write_string_to_grid(
|
||||
grid.write_string(
|
||||
h,
|
||||
grid,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs | Attr::BOLD,
|
||||
(pos_inc(upper_left, (x_offset, 0)), bottom_right),
|
||||
area.skip_cols(x_offset),
|
||||
None,
|
||||
);
|
||||
if self.sort_col as usize == i {
|
||||
|
@ -417,13 +453,12 @@ impl Component for JobManager {
|
|||
(false, Asc) => DataColumns::<5>::ARROW_UP,
|
||||
(false, Desc) => DataColumns::<5>::ARROW_DOWN,
|
||||
};
|
||||
write_string_to_grid(
|
||||
grid.write_string(
|
||||
arrow,
|
||||
grid,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
(pos_inc(upper_left, (x_offset + h.len(), 0)), bottom_right),
|
||||
area.skip_cols(x_offset + h.len()),
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
@ -432,10 +467,7 @@ impl Component for JobManager {
|
|||
context.dirty_areas.push_back(area);
|
||||
}
|
||||
|
||||
// Draw entry rows.
|
||||
if let Some(area) = skip_rows(area, 1) {
|
||||
self.draw_list(grid, area, context);
|
||||
}
|
||||
self.draw_list(grid, area.skip_rows(1), context);
|
||||
self.dirty = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,58 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#![deny(
|
||||
rustdoc::redundant_explicit_links,
|
||||
/* groups */
|
||||
clippy::correctness,
|
||||
clippy::suspicious,
|
||||
clippy::complexity,
|
||||
clippy::perf,
|
||||
clippy::cargo,
|
||||
clippy::nursery,
|
||||
clippy::style,
|
||||
/* restriction */
|
||||
clippy::dbg_macro,
|
||||
clippy::rc_buffer,
|
||||
clippy::as_underscore,
|
||||
clippy::assertions_on_result_states,
|
||||
/* rustdoc */
|
||||
rustdoc::broken_intra_doc_links,
|
||||
/* pedantic */
|
||||
//clippy::cast_lossless,
|
||||
//clippy::cast_possible_wrap,
|
||||
//clippy::ptr_as_ptr,
|
||||
clippy::doc_markdown,
|
||||
clippy::expect_fun_call,
|
||||
clippy::bool_to_int_with_if,
|
||||
clippy::borrow_as_ptr,
|
||||
clippy::cast_ptr_alignment,
|
||||
clippy::large_futures,
|
||||
clippy::waker_clone_wake,
|
||||
clippy::unused_enumerate_index,
|
||||
clippy::unnecessary_fallible_conversions,
|
||||
clippy::struct_field_names,
|
||||
clippy::manual_hash_one,
|
||||
clippy::into_iter_without_iter,
|
||||
)]
|
||||
#![allow(
|
||||
clippy::option_if_let_else,
|
||||
clippy::missing_const_for_fn,
|
||||
clippy::significant_drop_tightening,
|
||||
clippy::multiple_crate_versions,
|
||||
clippy::significant_drop_in_scrutinee,
|
||||
clippy::cognitive_complexity,
|
||||
clippy::manual_clamp
|
||||
)]
|
||||
/* Source Code Annotation Tags:
|
||||
*
|
||||
* Global tags (in tagref format <https://github.com/stepchowfun/tagref>) for source code
|
||||
* annotation:
|
||||
*
|
||||
* - tags from melib/src/lib.rs.
|
||||
* - [tag:hardcoded_color_value] Replace hardcoded color values with user configurable ones.
|
||||
*/
|
||||
|
||||
//!
|
||||
//! This crate contains the frontend stuff of the application. The application
|
||||
//! entry way on `src/bin.rs` creates an event loop and passes input to a
|
||||
|
@ -38,7 +90,6 @@ pub use melib::uuid;
|
|||
|
||||
pub extern crate bitflags;
|
||||
pub extern crate serde_json;
|
||||
#[macro_use]
|
||||
pub extern crate smallvec;
|
||||
pub extern crate termion;
|
||||
|
||||
|
@ -49,8 +100,8 @@ static GLOBAL: System = System;
|
|||
|
||||
pub extern crate melib;
|
||||
pub use melib::{
|
||||
error::*, log, AccountHash, Envelope, EnvelopeHash, EnvelopeRef, Flag, LogLevel, Mail, Mailbox,
|
||||
MailboxHash, ThreadHash, ToggleFlag,
|
||||
error::*, log, AccountHash, ActionFlag, Envelope, EnvelopeHash, EnvelopeRef, Flag, LogLevel,
|
||||
Mail, Mailbox, MailboxHash, ThreadHash, ToggleFlag,
|
||||
};
|
||||
|
||||
pub mod args;
|
||||
|
|
|
@ -30,8 +30,7 @@ use melib::{
|
|||
|
||||
use super::*;
|
||||
use crate::{
|
||||
boundaries::*,
|
||||
melib::text_processing::{TextProcessing, Truncate},
|
||||
melib::text::{TextProcessing, Truncate},
|
||||
uuid::Uuid,
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,7 +21,7 @@
|
|||
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
|
||||
pub enum EditAttachmentCursor {
|
||||
AttachmentNo(usize),
|
||||
#[default]
|
||||
|
@ -54,7 +54,7 @@ impl EditAttachments {
|
|||
let mut buttons = ButtonWidget::new(("Go Back".into(), FormButtonActions::Cancel));
|
||||
buttons.set_focus(true);
|
||||
buttons.set_cursor(1);
|
||||
EditAttachments {
|
||||
Self {
|
||||
account_hash,
|
||||
mode: EditAttachmentMode::Overview,
|
||||
buttons,
|
||||
|
@ -123,11 +123,10 @@ impl Component for EditAttachmentsRefMut<'_, '_> {
|
|||
} else if self.is_dirty() {
|
||||
let attachments_no = self.draft.attachments().len();
|
||||
let theme_default = crate::conf::value(context, "theme_default");
|
||||
clear_area(grid, area, theme_default);
|
||||
grid.clear_area(area, theme_default);
|
||||
if attachments_no == 0 {
|
||||
write_string_to_grid(
|
||||
grid.write_string(
|
||||
"no attachments",
|
||||
grid,
|
||||
theme_default.fg,
|
||||
theme_default.bg,
|
||||
theme_default.attrs,
|
||||
|
@ -135,9 +134,8 @@ impl Component for EditAttachmentsRefMut<'_, '_> {
|
|||
None,
|
||||
);
|
||||
} else {
|
||||
write_string_to_grid(
|
||||
grid.write_string(
|
||||
&format!("{} attachments ", attachments_no),
|
||||
grid,
|
||||
theme_default.fg,
|
||||
theme_default.bg,
|
||||
theme_default.attrs,
|
||||
|
@ -154,46 +152,34 @@ impl Component for EditAttachmentsRefMut<'_, '_> {
|
|||
} else {
|
||||
theme_default.bg
|
||||
};
|
||||
if let Some(name) = a.content_type().name() {
|
||||
write_string_to_grid(
|
||||
&format!(
|
||||
grid.write_string(
|
||||
&if let Some(name) = a.content_type().name() {
|
||||
format!(
|
||||
"[{}] \"{}\", {} {}",
|
||||
i,
|
||||
name,
|
||||
a.content_type(),
|
||||
melib::BytesDisplay(a.raw.len())
|
||||
),
|
||||
grid,
|
||||
theme_default.fg,
|
||||
bg,
|
||||
theme_default.attrs,
|
||||
(pos_inc(upper_left!(area), (0, 1 + i)), bottom_right!(area)),
|
||||
None,
|
||||
);
|
||||
} else {
|
||||
write_string_to_grid(
|
||||
&format!(
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"[{}] {} {}",
|
||||
i,
|
||||
a.content_type(),
|
||||
melib::BytesDisplay(a.raw.len())
|
||||
),
|
||||
grid,
|
||||
theme_default.fg,
|
||||
bg,
|
||||
theme_default.attrs,
|
||||
(pos_inc(upper_left!(area), (0, 1 + i)), bottom_right!(area)),
|
||||
None,
|
||||
);
|
||||
}
|
||||
)
|
||||
},
|
||||
theme_default.fg,
|
||||
bg,
|
||||
theme_default.attrs,
|
||||
area.skip(2, 2 + i),
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
self.inner.buttons.draw(
|
||||
grid,
|
||||
(
|
||||
pos_inc(upper_left!(area), (0, 1 + self.draft.attachments().len())),
|
||||
bottom_right!(area),
|
||||
),
|
||||
area.skip_rows(3 + self.draft.attachments().len()),
|
||||
context,
|
||||
);
|
||||
self.set_dirty(false);
|
||||
|
|
|
@ -29,7 +29,7 @@ pub enum KeySelection {
|
|||
secret: bool,
|
||||
local: bool,
|
||||
pattern: String,
|
||||
allow_remote_lookup: ToggleFlag,
|
||||
allow_remote_lookup: ActionFlag,
|
||||
},
|
||||
Error {
|
||||
id: ComponentId,
|
||||
|
@ -52,8 +52,8 @@ impl KeySelection {
|
|||
secret: bool,
|
||||
local: bool,
|
||||
pattern: String,
|
||||
allow_remote_lookup: ToggleFlag,
|
||||
context: &mut Context,
|
||||
allow_remote_lookup: ActionFlag,
|
||||
context: &Context,
|
||||
) -> Result<Self> {
|
||||
use melib::gpgme::*;
|
||||
let mut ctx = Context::new()?;
|
||||
|
@ -69,7 +69,7 @@ impl KeySelection {
|
|||
.spawn_specialized("gpg::keylist".into(), job);
|
||||
let mut progress_spinner = ProgressSpinner::new(8, context);
|
||||
progress_spinner.start();
|
||||
Ok(KeySelection::LoadingKeys {
|
||||
Ok(Self::LoadingKeys {
|
||||
handle,
|
||||
secret,
|
||||
local,
|
||||
|
@ -83,29 +83,28 @@ impl KeySelection {
|
|||
impl Component for KeySelection {
|
||||
fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
match self {
|
||||
KeySelection::LoadingKeys {
|
||||
Self::LoadingKeys {
|
||||
ref mut progress_spinner,
|
||||
..
|
||||
} => progress_spinner.draw(grid, center_area(area, (2, 2)), context),
|
||||
KeySelection::Error { ref err, .. } => {
|
||||
} => progress_spinner.draw(grid, area.center_inside((2, 2)), context),
|
||||
Self::Error { ref err, .. } => {
|
||||
let theme_default = crate::conf::value(context, "theme_default");
|
||||
write_string_to_grid(
|
||||
grid.write_string(
|
||||
&err.to_string(),
|
||||
grid,
|
||||
theme_default.fg,
|
||||
theme_default.bg,
|
||||
theme_default.attrs,
|
||||
center_area(area, (15, 2)),
|
||||
area.center_inside((15, 2)),
|
||||
Some(0),
|
||||
);
|
||||
}
|
||||
KeySelection::Loaded { ref mut widget, .. } => widget.draw(grid, area, context),
|
||||
Self::Loaded { ref mut widget, .. } => widget.draw(grid, area, context),
|
||||
}
|
||||
}
|
||||
|
||||
fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool {
|
||||
match self {
|
||||
KeySelection::LoadingKeys {
|
||||
Self::LoadingKeys {
|
||||
ref mut progress_spinner,
|
||||
ref mut handle,
|
||||
secret,
|
||||
|
@ -132,10 +131,10 @@ impl Component for KeySelection {
|
|||
Ok(w) => {
|
||||
*self = w;
|
||||
}
|
||||
Err(err) => *self = KeySelection::Error { err, id },
|
||||
Err(err) => *self = Self::Error { err, id },
|
||||
}
|
||||
} else if !*local && allow_remote_lookup.is_ask() {
|
||||
*self = KeySelection::Error {
|
||||
*self = Self::Error {
|
||||
err: Error::new(format!(
|
||||
"No keys found for {}, perform remote lookup?",
|
||||
pattern
|
||||
|
@ -143,12 +142,12 @@ impl Component for KeySelection {
|
|||
id,
|
||||
}
|
||||
} else {
|
||||
*self = KeySelection::Error {
|
||||
*self = Self::Error {
|
||||
err: Error::new(format!("No keys found for {}.", pattern)),
|
||||
id,
|
||||
}
|
||||
}
|
||||
if let KeySelection::Error { ref err, .. } = self {
|
||||
if let Self::Error { ref err, .. } = self {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
StatusEvent::DisplayMessage(err.to_string()),
|
||||
));
|
||||
|
@ -178,17 +177,17 @@ impl Component for KeySelection {
|
|||
move |id: ComponentId, results: &[melib::gpgme::Key]| {
|
||||
Some(UIEvent::FinishedUIDialog(
|
||||
id,
|
||||
Box::new(results.get(0).cloned()),
|
||||
Box::new(results.first().cloned()),
|
||||
))
|
||||
},
|
||||
)),
|
||||
context,
|
||||
));
|
||||
widget.set_dirty(true);
|
||||
*self = KeySelection::Loaded { widget, keys };
|
||||
*self = Self::Loaded { widget, keys };
|
||||
}
|
||||
Ok(Some(Err(err))) => {
|
||||
*self = KeySelection::Error {
|
||||
*self = Self::Error {
|
||||
err,
|
||||
id: ComponentId::default(),
|
||||
};
|
||||
|
@ -198,30 +197,30 @@ impl Component for KeySelection {
|
|||
}
|
||||
_ => progress_spinner.process_event(event, context),
|
||||
},
|
||||
KeySelection::Error { .. } => false,
|
||||
KeySelection::Loaded { ref mut widget, .. } => widget.process_event(event, context),
|
||||
Self::Error { .. } => false,
|
||||
Self::Loaded { ref mut widget, .. } => widget.process_event(event, context),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_dirty(&self) -> bool {
|
||||
match self {
|
||||
KeySelection::LoadingKeys {
|
||||
Self::LoadingKeys {
|
||||
ref progress_spinner,
|
||||
..
|
||||
} => progress_spinner.is_dirty(),
|
||||
KeySelection::Error { .. } => true,
|
||||
KeySelection::Loaded { ref widget, .. } => widget.is_dirty(),
|
||||
Self::Error { .. } => true,
|
||||
Self::Loaded { ref widget, .. } => widget.is_dirty(),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_dirty(&mut self, value: bool) {
|
||||
match self {
|
||||
KeySelection::LoadingKeys {
|
||||
Self::LoadingKeys {
|
||||
ref mut progress_spinner,
|
||||
..
|
||||
} => progress_spinner.set_dirty(value),
|
||||
KeySelection::Error { .. } => {}
|
||||
KeySelection::Loaded { ref mut widget, .. } => widget.set_dirty(value),
|
||||
Self::Error { .. } => {}
|
||||
Self::Loaded { ref mut widget, .. } => widget.set_dirty(value),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,29 +228,27 @@ impl Component for KeySelection {
|
|||
|
||||
fn shortcuts(&self, context: &Context) -> ShortcutMaps {
|
||||
match self {
|
||||
KeySelection::LoadingKeys { .. } | KeySelection::Error { .. } => {
|
||||
ShortcutMaps::default()
|
||||
}
|
||||
KeySelection::Loaded { ref widget, .. } => widget.shortcuts(context),
|
||||
Self::LoadingKeys { .. } | Self::Error { .. } => ShortcutMaps::default(),
|
||||
Self::Loaded { ref widget, .. } => widget.shortcuts(context),
|
||||
}
|
||||
}
|
||||
|
||||
fn id(&self) -> ComponentId {
|
||||
match self {
|
||||
KeySelection::LoadingKeys {
|
||||
Self::LoadingKeys {
|
||||
ref progress_spinner,
|
||||
..
|
||||
} => progress_spinner.id(),
|
||||
KeySelection::Error { ref id, .. } => *id,
|
||||
KeySelection::Loaded { ref widget, .. } => widget.id(),
|
||||
Self::Error { ref id, .. } => *id,
|
||||
Self::Loaded { ref widget, .. } => widget.id(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct GpgComposeState {
|
||||
pub sign_mail: ToggleFlag,
|
||||
pub encrypt_mail: ToggleFlag,
|
||||
pub sign_mail: Option<ActionFlag>,
|
||||
pub encrypt_mail: Option<ActionFlag>,
|
||||
pub encrypt_keys: Vec<melib::gpgme::Key>,
|
||||
pub encrypt_for_self: bool,
|
||||
pub sign_keys: Vec<melib::gpgme::Key>,
|
||||
|
@ -259,9 +256,9 @@ pub struct GpgComposeState {
|
|||
|
||||
impl Default for GpgComposeState {
|
||||
fn default() -> Self {
|
||||
GpgComposeState {
|
||||
sign_mail: ToggleFlag::Unset,
|
||||
encrypt_mail: ToggleFlag::Unset,
|
||||
Self {
|
||||
sign_mail: None,
|
||||
encrypt_mail: None,
|
||||
encrypt_keys: vec![],
|
||||
encrypt_for_self: true,
|
||||
sign_keys: vec![],
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -22,13 +22,13 @@
|
|||
use std::{collections::BTreeMap, iter::FromIterator};
|
||||
|
||||
use indexmap::IndexSet;
|
||||
use melib::{SortField, SortOrder, TagHash, Threads, UnixTimestamp};
|
||||
use melib::{Address, SortField, SortOrder, TagHash, Threads};
|
||||
|
||||
use super::*;
|
||||
use crate::{components::PageMovement, jobs::JoinHandle};
|
||||
|
||||
macro_rules! row_attr {
|
||||
($field:ident, $color_cache:expr, $unseen:expr, $highlighted:expr, $selected:expr $(,)*) => {{
|
||||
($field:ident, $color_cache:expr, unseen: $unseen:expr, highlighted: $highlighted:expr, selected: $selected:expr $(,)*) => {{
|
||||
let color_cache = &$color_cache;
|
||||
let unseen = $unseen;
|
||||
let highlighted = $highlighted;
|
||||
|
@ -65,7 +65,7 @@ macro_rules! row_attr {
|
|||
},
|
||||
}
|
||||
}};
|
||||
($color_cache:expr, $unseen:expr, $highlighted:expr, $selected:expr $(,)*) => {{
|
||||
($color_cache:expr, unseen: $unseen:expr, highlighted: $highlighted:expr, selected: $selected:expr $(,)*) => {{
|
||||
let color_cache = &$color_cache;
|
||||
let unseen = $unseen;
|
||||
let highlighted = $highlighted;
|
||||
|
@ -227,23 +227,20 @@ impl MailListingTrait for ConversationsListing {
|
|||
if !force && old_cursor_pos == self.new_cursor_pos && old_mailbox_hash == self.cursor_pos.1
|
||||
{
|
||||
self.kick_parent(self.parent, ListingMessage::UpdateView, context);
|
||||
} else if self.unfocused() {
|
||||
if let Some((thread_hash, env_hash)) = self
|
||||
} else if self.unfocused()
|
||||
&& self
|
||||
.get_thread_under_cursor(self.cursor_pos.2)
|
||||
.and_then(|thread| self.rows.thread_to_env.get(&thread).map(|e| (thread, e[0])))
|
||||
{
|
||||
self.kick_parent(
|
||||
self.parent,
|
||||
ListingMessage::OpenEntryUnderCursor {
|
||||
thread_hash,
|
||||
env_hash,
|
||||
show_thread: true,
|
||||
go_to_first_unread: true,
|
||||
},
|
||||
context,
|
||||
);
|
||||
self.set_focus(Focus::Entry, context);
|
||||
}
|
||||
.and_then(|thread| {
|
||||
self.rows
|
||||
.thread_to_env
|
||||
.get(&thread)
|
||||
.and_then(|e| Some((thread, e.first()?)))
|
||||
})
|
||||
.is_some()
|
||||
{
|
||||
self.force_draw = true;
|
||||
self.dirty = true;
|
||||
self.set_focus(Focus::Entry, context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,38 +409,32 @@ impl ListingTrait for ConversationsListing {
|
|||
|
||||
fn next_entry(&mut self, context: &mut Context) {
|
||||
if self
|
||||
.get_thread_under_cursor(self.cursor_pos.2 + 1)
|
||||
.get_thread_under_cursor(self.new_cursor_pos.2 + 1)
|
||||
.is_some()
|
||||
{
|
||||
// [ref:TODO]: makes this less ugly.
|
||||
self.movement = Some(PageMovement::Down(1));
|
||||
self.perform_movement(None);
|
||||
self.force_draw = true;
|
||||
self.dirty = true;
|
||||
self.cursor_pos.2 += 1;
|
||||
self.new_cursor_pos.2 += 1;
|
||||
self.set_focus(Focus::Entry, context);
|
||||
self.cursor_pos.2 -= 1;
|
||||
self.new_cursor_pos.2 -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
fn prev_entry(&mut self, context: &mut Context) {
|
||||
if self.cursor_pos.2 == 0 {
|
||||
if self.new_cursor_pos.2 == 0 {
|
||||
return;
|
||||
}
|
||||
if self
|
||||
.get_thread_under_cursor(self.cursor_pos.2 - 1)
|
||||
.get_thread_under_cursor(self.new_cursor_pos.2 - 1)
|
||||
.is_some()
|
||||
{
|
||||
// [ref:TODO]: makes this less ugly.
|
||||
self.movement = Some(PageMovement::Up(1));
|
||||
self.perform_movement(None);
|
||||
self.force_draw = true;
|
||||
self.dirty = true;
|
||||
self.cursor_pos.2 -= 1;
|
||||
self.new_cursor_pos.2 -= 1;
|
||||
self.set_focus(Focus::Entry, context);
|
||||
self.cursor_pos.2 += 1;
|
||||
self.new_cursor_pos.2 += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -460,13 +451,10 @@ impl ListingTrait for ConversationsListing {
|
|||
{
|
||||
self.refresh_mailbox(context, false);
|
||||
}
|
||||
let upper_left = upper_left!(area);
|
||||
let bottom_right = bottom_right!(area);
|
||||
if let Err(message) = self.error.as_ref() {
|
||||
clear_area(grid, area, self.color_cache.theme_default);
|
||||
write_string_to_grid(
|
||||
grid.clear_area(area, self.color_cache.theme_default);
|
||||
grid.write_string(
|
||||
message,
|
||||
grid,
|
||||
self.color_cache.theme_default.fg,
|
||||
self.color_cache.theme_default.bg,
|
||||
self.color_cache.theme_default.attrs,
|
||||
|
@ -476,51 +464,21 @@ impl ListingTrait for ConversationsListing {
|
|||
context.dirty_areas.push_back(area);
|
||||
return;
|
||||
}
|
||||
let rows = (get_y(bottom_right) - get_y(upper_left) + 1) / 3;
|
||||
let rows = area.height() / 3;
|
||||
|
||||
if rows == 0 {
|
||||
return;
|
||||
}
|
||||
if let Some(mvm) = self.movement.take() {
|
||||
match mvm {
|
||||
PageMovement::Up(amount) => {
|
||||
self.new_cursor_pos.2 = self.new_cursor_pos.2.saturating_sub(amount);
|
||||
}
|
||||
PageMovement::PageUp(multiplier) => {
|
||||
self.new_cursor_pos.2 = self.new_cursor_pos.2.saturating_sub(rows * multiplier);
|
||||
}
|
||||
PageMovement::Down(amount) => {
|
||||
if self.new_cursor_pos.2 + amount + 1 < self.length {
|
||||
self.new_cursor_pos.2 += amount;
|
||||
} else {
|
||||
self.new_cursor_pos.2 = self.length.saturating_sub(1);
|
||||
}
|
||||
}
|
||||
PageMovement::PageDown(multiplier) => {
|
||||
if self.new_cursor_pos.2 + rows * multiplier + 1 < self.length {
|
||||
self.new_cursor_pos.2 += rows * multiplier;
|
||||
} else if self.new_cursor_pos.2 + rows * multiplier > self.length {
|
||||
self.new_cursor_pos.2 = self.length.saturating_sub(1);
|
||||
} else {
|
||||
self.new_cursor_pos.2 = (self.length.saturating_sub(1) / rows) * rows;
|
||||
}
|
||||
}
|
||||
PageMovement::Right(_) | PageMovement::Left(_) => {}
|
||||
PageMovement::Home => {
|
||||
self.new_cursor_pos.2 = 0;
|
||||
}
|
||||
PageMovement::End => {
|
||||
self.new_cursor_pos.2 = self.length.saturating_sub(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.perform_movement(Some(rows));
|
||||
|
||||
let prev_page_no = (self.cursor_pos.2).wrapping_div(rows);
|
||||
let page_no = (self.new_cursor_pos.2).wrapping_div(rows);
|
||||
|
||||
let top_idx = page_no * rows;
|
||||
|
||||
/* If cursor position has changed, remove the highlight from the previous
|
||||
* position and apply it in the new one. */
|
||||
// If cursor position has changed, remove the highlight from the previous
|
||||
// position and apply it in the new one.
|
||||
if self.cursor_pos.2 != self.new_cursor_pos.2 && prev_page_no == page_no {
|
||||
let old_cursor_pos = self.cursor_pos;
|
||||
self.cursor_pos = self.new_cursor_pos;
|
||||
|
@ -528,10 +486,7 @@ impl ListingTrait for ConversationsListing {
|
|||
if *idx >= self.length {
|
||||
continue; //bounds check
|
||||
}
|
||||
let new_area = (
|
||||
set_y(upper_left, get_y(upper_left) + 3 * (*idx % rows)),
|
||||
set_y(bottom_right, get_y(upper_left) + 3 * (*idx % rows) + 2),
|
||||
);
|
||||
let new_area = area.skip_rows(3 * (*idx % rows)).take_rows(2);
|
||||
self.highlight_line(grid, new_area, *idx, context);
|
||||
context.dirty_areas.push_back(new_area);
|
||||
}
|
||||
|
@ -546,23 +501,18 @@ impl ListingTrait for ConversationsListing {
|
|||
self.cursor_pos.2 = self.new_cursor_pos.2;
|
||||
}
|
||||
|
||||
clear_area(grid, area, self.color_cache.theme_default);
|
||||
/* Page_no has changed, so draw new page */
|
||||
grid.clear_area(area, self.color_cache.theme_default);
|
||||
// Page_no has changed, so draw new page
|
||||
self.draw_rows(grid, area, context, top_idx);
|
||||
|
||||
self.highlight_line(
|
||||
grid,
|
||||
(
|
||||
pos_inc(upper_left, (0, 3 * (self.cursor_pos.2 % rows))),
|
||||
set_y(
|
||||
bottom_right,
|
||||
get_y(upper_left) + 3 * (self.cursor_pos.2 % rows) + 2,
|
||||
),
|
||||
),
|
||||
area.skip_rows(3 * (self.cursor_pos.2 % rows)).take_rows(3),
|
||||
self.cursor_pos.2,
|
||||
context,
|
||||
);
|
||||
|
||||
self.force_draw = false;
|
||||
context.dirty_areas.push_back(area);
|
||||
}
|
||||
|
||||
|
@ -648,16 +598,20 @@ impl ListingTrait for ConversationsListing {
|
|||
match new_value {
|
||||
Focus::None => {
|
||||
self.dirty = true;
|
||||
/* If self.rows.row_updates is not empty and we exit a thread, the row_update
|
||||
* events will be performed but the list will not be drawn.
|
||||
* So force a draw in any case.
|
||||
*/
|
||||
// If self.rows.row_updates is not empty and we exit a thread, the row_update
|
||||
// events will be performed but the list will not be drawn. So force a draw in
|
||||
// any case.
|
||||
self.force_draw = true;
|
||||
}
|
||||
Focus::Entry => {
|
||||
if let Some((thread_hash, env_hash)) = self
|
||||
.get_thread_under_cursor(self.cursor_pos.2)
|
||||
.and_then(|thread| self.rows.thread_to_env.get(&thread).map(|e| (thread, e[0])))
|
||||
.get_thread_under_cursor(self.new_cursor_pos.2)
|
||||
.and_then(|thread| {
|
||||
self.rows
|
||||
.thread_to_env
|
||||
.get(&thread)
|
||||
.and_then(|e| Some((thread, *e.first()?)))
|
||||
})
|
||||
{
|
||||
self.force_draw = true;
|
||||
self.dirty = true;
|
||||
|
@ -671,6 +625,7 @@ impl ListingTrait for ConversationsListing {
|
|||
},
|
||||
context,
|
||||
);
|
||||
self.cursor_pos.2 = self.new_cursor_pos.2;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
@ -726,7 +681,7 @@ impl ConversationsListing {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(super) fn make_entry_string(
|
||||
fn make_entry_string(
|
||||
&self,
|
||||
root_envelope: &Envelope,
|
||||
context: &Context,
|
||||
|
@ -795,53 +750,28 @@ impl ConversationsListing {
|
|||
root_envelope.subject().trim().to_string()
|
||||
};
|
||||
EntryStrings {
|
||||
date: DateString(ConversationsListing::format_date(context, thread.date())),
|
||||
date: DateString(self.format_date(context, thread.date())),
|
||||
subject: SubjectString(if thread.len() > 1 {
|
||||
format!("{} ({})", subject, thread.len())
|
||||
} else {
|
||||
subject
|
||||
}),
|
||||
flag: FlagString(format!(
|
||||
"{}{}",
|
||||
if thread.has_attachments() { "š" } else { "" },
|
||||
if thread.snoozed() { "š¤" } else { "" }
|
||||
)),
|
||||
from: FromString(address_list!((from) as comma_sep_list)),
|
||||
flag: FlagString::new(
|
||||
root_envelope.flags(),
|
||||
self.rows
|
||||
.selection
|
||||
.get(&root_envelope.hash())
|
||||
.cloned()
|
||||
.unwrap_or(false),
|
||||
thread.snoozed(),
|
||||
thread.unseen() > 0,
|
||||
thread.has_attachments(),
|
||||
context,
|
||||
(self.cursor_pos.0, self.cursor_pos.1),
|
||||
),
|
||||
from: FromString(Address::display_name_slice(from)),
|
||||
tags: TagString(tags_string, colors),
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn format_date(context: &Context, epoch: UnixTimestamp) -> String {
|
||||
let d = std::time::UNIX_EPOCH + std::time::Duration::from_secs(epoch);
|
||||
let now: std::time::Duration = std::time::SystemTime::now()
|
||||
.duration_since(d)
|
||||
.unwrap_or_else(|_| std::time::Duration::new(std::u64::MAX, 0));
|
||||
match now.as_secs() {
|
||||
n if context.settings.listing.recent_dates && n < 60 * 60 => format!(
|
||||
"{} minute{} ago",
|
||||
n / (60),
|
||||
if n / 60 == 1 { "" } else { "s" }
|
||||
),
|
||||
n if context.settings.listing.recent_dates && n < 24 * 60 * 60 => format!(
|
||||
"{} hour{} ago",
|
||||
n / (60 * 60),
|
||||
if n / (60 * 60) == 1 { "" } else { "s" }
|
||||
),
|
||||
n if context.settings.listing.recent_dates && n < 7 * 24 * 60 * 60 => format!(
|
||||
"{} day{} ago",
|
||||
n / (24 * 60 * 60),
|
||||
if n / (24 * 60 * 60) == 1 { "" } else { "s" }
|
||||
),
|
||||
_ => melib::utils::datetime::timestamp_to_string(
|
||||
epoch,
|
||||
context
|
||||
.settings
|
||||
.listing
|
||||
.datetime_fmt
|
||||
.as_deref()
|
||||
.or(Some("%Y-%m-%d %T")),
|
||||
false,
|
||||
),
|
||||
highlight_self: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -921,145 +851,168 @@ impl ConversationsListing {
|
|||
fn draw_rows(&self, grid: &mut CellBuffer, area: Area, context: &Context, top_idx: usize) {
|
||||
let account = &context.accounts[&self.cursor_pos.0];
|
||||
let threads = account.collection.get_threads(self.cursor_pos.1);
|
||||
clear_area(grid, area, self.color_cache.theme_default);
|
||||
let (mut upper_left, bottom_right) = area;
|
||||
grid.clear_area(area, self.color_cache.theme_default);
|
||||
for (idx, ((thread_hash, root_env_hash), strings)) in
|
||||
self.rows.entries.iter().enumerate().skip(top_idx)
|
||||
{
|
||||
if !context.accounts[&self.cursor_pos.0].contains_key(*root_env_hash) {
|
||||
panic!();
|
||||
continue;
|
||||
}
|
||||
let area = area.skip_rows(3 * (idx - top_idx)).take_rows(3);
|
||||
let thread = threads.thread_ref(*thread_hash);
|
||||
|
||||
let row_attr = row_attr!(
|
||||
self.color_cache,
|
||||
thread.unseen() > 0,
|
||||
self.cursor_pos.2 == idx,
|
||||
self.rows.is_thread_selected(*thread_hash)
|
||||
unseen: thread.unseen() > 0,
|
||||
highlighted: self.cursor_pos.2 == idx,
|
||||
selected: self.rows.is_thread_selected(*thread_hash)
|
||||
);
|
||||
/* draw flags */
|
||||
let (x, _) = write_string_to_grid(
|
||||
// draw flags
|
||||
let (mut x, _) = grid.write_string(
|
||||
&strings.flag,
|
||||
grid,
|
||||
row_attr.fg,
|
||||
row_attr.bg,
|
||||
row_attr.attrs,
|
||||
(upper_left, bottom_right),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
for x in x..(x + 3) {
|
||||
grid[set_x(upper_left, x)].set_bg(row_attr.bg);
|
||||
if !strings.flag.is_empty() {
|
||||
for c in grid.row_iter(area, x..(x + 3), 0) {
|
||||
grid[c].set_bg(row_attr.bg);
|
||||
}
|
||||
x += 3;
|
||||
}
|
||||
let subject_attr = row_attr!(
|
||||
subject,
|
||||
self.color_cache,
|
||||
thread.unseen() > 0,
|
||||
self.cursor_pos.2 == idx,
|
||||
self.rows.is_thread_selected(*thread_hash)
|
||||
unseen: thread.unseen() > 0,
|
||||
highlighted: self.cursor_pos.2 == idx,
|
||||
selected: self.rows.is_thread_selected(*thread_hash)
|
||||
);
|
||||
/* draw subject */
|
||||
let (mut x, subject_overflowed) = write_string_to_grid(
|
||||
// draw subject
|
||||
let (x_, subject_overflowed) = grid.write_string(
|
||||
&strings.subject,
|
||||
grid,
|
||||
subject_attr.fg,
|
||||
subject_attr.bg,
|
||||
subject_attr.attrs,
|
||||
(set_x(upper_left, x), bottom_right),
|
||||
area.skip_cols(x),
|
||||
None,
|
||||
);
|
||||
let mut subject_overflowed = subject_overflowed > get_y(upper_left);
|
||||
x += x_;
|
||||
let mut subject_overflowed = subject_overflowed > 0;
|
||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||
if subject_overflowed {
|
||||
break;
|
||||
};
|
||||
let area = area.skip_cols(x).take_cols(t.grapheme_width() + 2);
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _y) = write_string_to_grid(
|
||||
let (_x, _y) = grid.write_string(
|
||||
t,
|
||||
grid,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
self.color_cache.tag_default.attrs,
|
||||
(set_x(upper_left, x + 1), bottom_right),
|
||||
area.skip_cols(1),
|
||||
None,
|
||||
);
|
||||
if _y > get_y(upper_left) {
|
||||
if _y > 0 {
|
||||
subject_overflowed = true;
|
||||
break;
|
||||
}
|
||||
grid[set_x(upper_left, x)].set_bg(color);
|
||||
if _x <= get_x(bottom_right) {
|
||||
grid[set_x(upper_left, _x)].set_bg(color).set_keep_bg(true);
|
||||
}
|
||||
for x in (x + 1).._x {
|
||||
grid[set_x(upper_left, x)]
|
||||
for c in grid.row_iter(area, 0..area.width(), 0) {
|
||||
grid[c]
|
||||
.set_keep_fg(true)
|
||||
.set_keep_bg(true);
|
||||
.set_bg(color)
|
||||
.set_keep_bg(true)
|
||||
.set_attrs(self.color_cache.tag_default.attrs);
|
||||
}
|
||||
grid[set_x(upper_left, x)].set_keep_bg(true);
|
||||
x = _x + 1;
|
||||
x += _x + 2;
|
||||
}
|
||||
if !subject_overflowed {
|
||||
for x in x..get_x(bottom_right) {
|
||||
grid[set_x(upper_left, x)]
|
||||
.set_ch(' ')
|
||||
.set_fg(row_attr.fg)
|
||||
.set_bg(row_attr.bg);
|
||||
for c in grid.row_iter(area, x..area.width(), 0) {
|
||||
grid[c].set_ch(' ').set_fg(row_attr.fg).set_bg(row_attr.bg);
|
||||
}
|
||||
}
|
||||
// Next line, draw date
|
||||
let date_attr = row_attr!(
|
||||
date,
|
||||
self.color_cache,
|
||||
thread.unseen() > 0,
|
||||
self.cursor_pos.2 == idx,
|
||||
self.rows.is_thread_selected(*thread_hash)
|
||||
unseen: thread.unseen() > 0,
|
||||
highlighted: self.cursor_pos.2 == idx,
|
||||
selected: self.rows.is_thread_selected(*thread_hash)
|
||||
);
|
||||
upper_left.1 += 1;
|
||||
if upper_left.1 >= bottom_right.1 {
|
||||
return;
|
||||
}
|
||||
/* Next line, draw date */
|
||||
let (x, _) = write_string_to_grid(
|
||||
&strings.date,
|
||||
grid,
|
||||
date_attr.fg,
|
||||
date_attr.bg,
|
||||
date_attr.attrs,
|
||||
(upper_left, bottom_right),
|
||||
None,
|
||||
);
|
||||
for x in x..(x + 4) {
|
||||
grid[set_x(upper_left, x)]
|
||||
.set_ch('ā')
|
||||
.set_fg(row_attr.fg)
|
||||
.set_bg(row_attr.bg);
|
||||
x = 0;
|
||||
x += grid
|
||||
.write_string(
|
||||
&strings.date,
|
||||
date_attr.fg,
|
||||
date_attr.bg,
|
||||
date_attr.attrs,
|
||||
area.skip(x, 1),
|
||||
None,
|
||||
)
|
||||
.0;
|
||||
for c in grid.row_iter(area, x..(x + 4), 1) {
|
||||
grid[c].set_ch('ā').set_fg(row_attr.fg).set_bg(row_attr.bg);
|
||||
}
|
||||
x += 4;
|
||||
let from_attr = row_attr!(
|
||||
from,
|
||||
self.color_cache,
|
||||
thread.unseen() > 0,
|
||||
self.cursor_pos.2 == idx,
|
||||
self.rows.is_thread_selected(*thread_hash)
|
||||
);
|
||||
/* draw from */
|
||||
let (x, _) = write_string_to_grid(
|
||||
&strings.from,
|
||||
grid,
|
||||
from_attr.fg,
|
||||
from_attr.bg,
|
||||
from_attr.attrs,
|
||||
(set_x(upper_left, x + 4), bottom_right),
|
||||
None,
|
||||
unseen: thread.unseen() > 0,
|
||||
highlighted: self.cursor_pos.2 == idx,
|
||||
selected: self.rows.is_thread_selected(*thread_hash)
|
||||
);
|
||||
// draw from
|
||||
x += grid
|
||||
.write_string(
|
||||
&strings.from,
|
||||
from_attr.fg,
|
||||
from_attr.bg,
|
||||
from_attr.attrs,
|
||||
area.skip(x, 1),
|
||||
None,
|
||||
)
|
||||
.0;
|
||||
|
||||
for x in x..get_x(bottom_right) {
|
||||
grid[set_x(upper_left, x)]
|
||||
.set_ch('ā')
|
||||
.set_fg(row_attr.fg)
|
||||
.set_bg(row_attr.bg);
|
||||
for c in grid.row_iter(area, x..area.width(), 1) {
|
||||
grid[c].set_ch('ā').set_fg(row_attr.fg).set_bg(row_attr.bg);
|
||||
}
|
||||
upper_left.1 += 2;
|
||||
if upper_left.1 >= bottom_right.1 {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fn perform_movement(&mut self, height: Option<usize>) {
|
||||
let rows = height.unwrap_or(1);
|
||||
if let Some(mvm) = self.movement.take() {
|
||||
match mvm {
|
||||
PageMovement::Up(amount) => {
|
||||
self.new_cursor_pos.2 = self.new_cursor_pos.2.saturating_sub(amount);
|
||||
}
|
||||
PageMovement::PageUp(multiplier) => {
|
||||
self.new_cursor_pos.2 = self.new_cursor_pos.2.saturating_sub(rows * multiplier);
|
||||
}
|
||||
PageMovement::Down(amount) => {
|
||||
if self.new_cursor_pos.2 + amount + 1 < self.length {
|
||||
self.new_cursor_pos.2 += amount;
|
||||
} else {
|
||||
self.new_cursor_pos.2 = self.length.saturating_sub(1);
|
||||
}
|
||||
}
|
||||
PageMovement::PageDown(multiplier) => {
|
||||
if self.new_cursor_pos.2 + rows * multiplier + 1 < self.length {
|
||||
self.new_cursor_pos.2 += rows * multiplier;
|
||||
} else if self.new_cursor_pos.2 + rows * multiplier > self.length {
|
||||
self.new_cursor_pos.2 = self.length.saturating_sub(1);
|
||||
} else {
|
||||
self.new_cursor_pos.2 = (self.length.saturating_sub(1) / rows) * rows;
|
||||
}
|
||||
}
|
||||
PageMovement::Right(_) | PageMovement::Left(_) => {}
|
||||
PageMovement::Home => {
|
||||
self.new_cursor_pos.2 = 0;
|
||||
}
|
||||
PageMovement::End => {
|
||||
self.new_cursor_pos.2 = self.length.saturating_sub(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1076,45 +1029,39 @@ impl Component for ConversationsListing {
|
|||
return;
|
||||
}
|
||||
|
||||
let (upper_left, bottom_right) = area;
|
||||
{
|
||||
let mut area = area;
|
||||
|
||||
if !self.filter_term.is_empty() {
|
||||
let (x, y) = write_string_to_grid(
|
||||
let (x, y) = grid.write_string(
|
||||
&format!(
|
||||
"{} results for `{}` (Press ESC to exit)",
|
||||
self.filtered_selection.len(),
|
||||
self.filter_term
|
||||
),
|
||||
grid,
|
||||
self.color_cache.theme_default.fg,
|
||||
self.color_cache.theme_default.bg,
|
||||
self.color_cache.theme_default.attrs,
|
||||
area,
|
||||
Some(get_x(upper_left)),
|
||||
Some(0),
|
||||
);
|
||||
for c in grid.row_iter(x..(get_x(bottom_right) + 1), y) {
|
||||
for c in grid.row_iter(area, x..area.width(), y) {
|
||||
grid[c] = Cell::default();
|
||||
}
|
||||
clear_area(
|
||||
grid,
|
||||
((x, y), set_y(bottom_right, y)),
|
||||
self.color_cache.theme_default,
|
||||
);
|
||||
context
|
||||
.dirty_areas
|
||||
.push_back((upper_left, set_y(bottom_right, y + 1)));
|
||||
|
||||
area = (set_y(upper_left, y + 1), bottom_right);
|
||||
grid.clear_area(area.skip(x, y), self.color_cache.theme_default);
|
||||
context.dirty_areas.push_back(area.nth_row(0));
|
||||
|
||||
area = area.skip_rows(1);
|
||||
}
|
||||
let (upper_left, bottom_right) = area;
|
||||
let rows = (get_y(bottom_right) - get_y(upper_left) + 1) / 3;
|
||||
let rows = area.height() / 3;
|
||||
if let Some(modifier) = self.modifier_command.take() {
|
||||
if let Some(mvm) = self.movement.as_ref() {
|
||||
match mvm {
|
||||
PageMovement::Up(amount) => {
|
||||
for c in self.cursor_pos.2.saturating_sub(*amount)..=self.cursor_pos.2 {
|
||||
for c in self.new_cursor_pos.2.saturating_sub(*amount)
|
||||
..=self.new_cursor_pos.2
|
||||
{
|
||||
if let Some(thread) = self.get_thread_under_cursor(c) {
|
||||
self.rows.update_selection_with_thread(
|
||||
thread,
|
||||
|
@ -1130,8 +1077,8 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
}
|
||||
if modifier == Modifier::Intersection {
|
||||
for c in (0..self.cursor_pos.2.saturating_sub(*amount))
|
||||
.chain((self.cursor_pos.2 + 2)..self.length)
|
||||
for c in (0..self.new_cursor_pos.2.saturating_sub(*amount))
|
||||
.chain((self.new_cursor_pos.2 + 2)..self.length)
|
||||
{
|
||||
if let Some(thread) = self.get_thread_under_cursor(c) {
|
||||
self.rows
|
||||
|
@ -1141,8 +1088,8 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
}
|
||||
PageMovement::PageUp(multiplier) => {
|
||||
for c in self.cursor_pos.2.saturating_sub(rows * multiplier)
|
||||
..=self.cursor_pos.2
|
||||
for c in self.new_cursor_pos.2.saturating_sub(rows * multiplier)
|
||||
..=self.new_cursor_pos.2
|
||||
{
|
||||
if let Some(thread) = self.get_thread_under_cursor(c) {
|
||||
self.rows.update_selection_with_thread(
|
||||
|
@ -1160,8 +1107,8 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
}
|
||||
PageMovement::Down(amount) => {
|
||||
for c in self.cursor_pos.2
|
||||
..std::cmp::min(self.length, self.cursor_pos.2 + amount + 1)
|
||||
for c in self.new_cursor_pos.2
|
||||
..std::cmp::min(self.length, self.new_cursor_pos.2 + amount + 1)
|
||||
{
|
||||
if let Some(thread) = self.get_thread_under_cursor(c) {
|
||||
self.rows.update_selection_with_thread(
|
||||
|
@ -1178,9 +1125,9 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
}
|
||||
if modifier == Modifier::Intersection {
|
||||
for c in (0..self.cursor_pos.2).chain(
|
||||
(std::cmp::min(self.length, self.cursor_pos.2 + amount + 1) + 1)
|
||||
..self.length,
|
||||
for c in (0..self.new_cursor_pos.2).chain(
|
||||
(std::cmp::min(self.length, self.new_cursor_pos.2 + amount + 1)
|
||||
+ 1)..self.length,
|
||||
) {
|
||||
if let Some(thread) = self.get_thread_under_cursor(c) {
|
||||
self.rows
|
||||
|
@ -1190,9 +1137,9 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
}
|
||||
PageMovement::PageDown(multiplier) => {
|
||||
for c in self.cursor_pos.2
|
||||
for c in self.new_cursor_pos.2
|
||||
..std::cmp::min(
|
||||
self.cursor_pos.2 + rows * multiplier + 1,
|
||||
self.new_cursor_pos.2 + rows * multiplier + 1,
|
||||
self.length,
|
||||
)
|
||||
{
|
||||
|
@ -1211,9 +1158,9 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
}
|
||||
if modifier == Modifier::Intersection {
|
||||
for c in (0..self.cursor_pos.2).chain(
|
||||
for c in (0..self.new_cursor_pos.2).chain(
|
||||
(std::cmp::min(
|
||||
self.cursor_pos.2 + rows * multiplier + 1,
|
||||
self.new_cursor_pos.2 + rows * multiplier + 1,
|
||||
self.length,
|
||||
) + 1)..self.length,
|
||||
) {
|
||||
|
@ -1226,7 +1173,7 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
PageMovement::Right(_) | PageMovement::Left(_) => {}
|
||||
PageMovement::Home => {
|
||||
for c in 0..=self.cursor_pos.2 {
|
||||
for c in 0..=self.new_cursor_pos.2 {
|
||||
if let Some(thread) = self.get_thread_under_cursor(c) {
|
||||
self.rows.update_selection_with_thread(
|
||||
thread,
|
||||
|
@ -1242,7 +1189,7 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
}
|
||||
if modifier == Modifier::Intersection {
|
||||
for c in (self.cursor_pos.2 + 1)..self.length {
|
||||
for c in (self.new_cursor_pos.2 + 1)..self.length {
|
||||
if let Some(thread) = self.get_thread_under_cursor(c) {
|
||||
self.rows
|
||||
.update_selection_with_thread(thread, |e| *e = false);
|
||||
|
@ -1251,7 +1198,7 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
}
|
||||
PageMovement::End => {
|
||||
for c in self.cursor_pos.2..self.length {
|
||||
for c in self.new_cursor_pos.2..self.length {
|
||||
if let Some(thread) = self.get_thread_under_cursor(c) {
|
||||
self.rows.update_selection_with_thread(
|
||||
thread,
|
||||
|
@ -1267,7 +1214,7 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
}
|
||||
if modifier == Modifier::Intersection {
|
||||
for c in 0..self.cursor_pos.2 {
|
||||
for c in 0..self.new_cursor_pos.2 {
|
||||
if let Some(thread) = self.get_thread_under_cursor(c) {
|
||||
self.rows
|
||||
.update_selection_with_thread(thread, |e| *e = false);
|
||||
|
@ -1281,51 +1228,51 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
|
||||
if !self.rows.row_updates.is_empty() {
|
||||
/* certain rows need to be updated (eg an unseen message was just set seen)
|
||||
*/
|
||||
// certain rows need to be updated (eg an unseen message was just set seen)
|
||||
while let Some(row) = self.rows.row_updates.pop() {
|
||||
self.update_line(context, row);
|
||||
let row: usize = self.rows.env_order[&row];
|
||||
|
||||
let page_no = (self.cursor_pos.2).wrapping_div(rows);
|
||||
let page_no = (self.new_cursor_pos.2).wrapping_div(rows);
|
||||
|
||||
let top_idx = page_no * rows;
|
||||
/* Update row only if it's currently visible */
|
||||
// Update row only if it's currently visible
|
||||
if row >= top_idx && row < top_idx + rows {
|
||||
let area = (
|
||||
set_y(upper_left, get_y(upper_left) + (3 * (row % rows))),
|
||||
set_y(bottom_right, get_y(upper_left) + (3 * (row % rows) + 2)),
|
||||
);
|
||||
let area = area.skip_rows(3 * (row % rows)).take_rows(3);
|
||||
self.highlight_line(grid, area, row, context);
|
||||
context.dirty_areas.push_back(area);
|
||||
}
|
||||
}
|
||||
if self.force_draw {
|
||||
/* Draw the entire list */
|
||||
// Draw the entire list
|
||||
let area = if matches!(self.focus, Focus::Entry) {
|
||||
area.take_cols(area.width() / 3)
|
||||
} else {
|
||||
area
|
||||
};
|
||||
self.draw_list(grid, area, context);
|
||||
self.force_draw = false;
|
||||
}
|
||||
} else {
|
||||
/* Draw the entire list */
|
||||
// Draw the entire list
|
||||
let area = if matches!(self.focus, Focus::Entry) {
|
||||
area.take_cols(area.width() / 3)
|
||||
} else {
|
||||
area
|
||||
};
|
||||
self.draw_list(grid, area, context);
|
||||
}
|
||||
}
|
||||
if matches!(self.focus, Focus::Entry) {
|
||||
if self.length == 0 && self.dirty {
|
||||
clear_area(grid, area, self.color_cache.theme_default);
|
||||
grid.clear_area(area, self.color_cache.theme_default);
|
||||
context.dirty_areas.push_back(area);
|
||||
return;
|
||||
}
|
||||
|
||||
let entry_area = (
|
||||
set_x(upper_left, get_x(upper_left) + width!(area) / 3 + 2),
|
||||
bottom_right,
|
||||
);
|
||||
let gap_area = (
|
||||
pos_dec(upper_left!(entry_area), (1, 0)),
|
||||
bottom_right!(entry_area),
|
||||
);
|
||||
clear_area(grid, gap_area, self.color_cache.theme_default);
|
||||
let entry_area = area.skip_cols(1 + area.width() / 3);
|
||||
let gap_area = area.nth_col(area.width() / 3);
|
||||
grid.clear_area(gap_area, self.color_cache.theme_default);
|
||||
context.dirty_areas.push_back(gap_area);
|
||||
self.view_area = entry_area.into();
|
||||
}
|
||||
|
@ -1336,6 +1283,11 @@ impl Component for ConversationsListing {
|
|||
let shortcuts = self.shortcuts(context);
|
||||
|
||||
match (&event, self.focus) {
|
||||
(UIEvent::VisibilityChange(true), _) => {
|
||||
self.force_draw = true;
|
||||
self.set_dirty(true);
|
||||
return true;
|
||||
}
|
||||
(UIEvent::Input(ref k), Focus::Entry)
|
||||
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"]) =>
|
||||
{
|
||||
|
@ -1465,23 +1417,21 @@ impl Component for ConversationsListing {
|
|||
return true;
|
||||
}
|
||||
Action::Listing(ToggleThreadSnooze) if !self.unfocused() => {
|
||||
/*
|
||||
if let Some(thread) = self.get_thread_under_cursor(self.cursor_pos.2) {
|
||||
let account = &mut context.accounts[&self.cursor_pos.0];
|
||||
account
|
||||
.collection
|
||||
.threads
|
||||
.write()
|
||||
.unwrap()
|
||||
.entry(self.cursor_pos.1)
|
||||
.and_modify(|threads| {
|
||||
let is_snoozed = threads.thread_ref(thread).snoozed();
|
||||
threads.thread_ref_mut(thread).set_snoozed(!is_snoozed);
|
||||
});
|
||||
self.rows.row_updates.push(thread);
|
||||
self.refresh_mailbox(context, false);
|
||||
}
|
||||
*/
|
||||
//if let Some(thread) = self.get_thread_under_cursor(self.cursor_pos.2) {
|
||||
// let account = &mut context.accounts[&self.cursor_pos.0];
|
||||
// account
|
||||
// .collection
|
||||
// .threads
|
||||
// .write()
|
||||
// .unwrap()
|
||||
// .entry(self.cursor_pos.1)
|
||||
// .and_modify(|threads| {
|
||||
// let is_snoozed = threads.thread_ref(thread).snoozed();
|
||||
// threads.thread_ref_mut(thread).set_snoozed(!is_snoozed);
|
||||
// });
|
||||
// self.rows.row_updates.push(thread);
|
||||
// self.refresh_mailbox(context, false);
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
_ => {}
|
||||
|
@ -1526,11 +1476,12 @@ impl Component for ConversationsListing {
|
|||
self.search_job = Some((filter_term.to_string(), handle));
|
||||
}
|
||||
Err(err) => {
|
||||
context.replies.push_back(UIEvent::Notification(
|
||||
Some("Could not perform search".to_string()),
|
||||
err.to_string(),
|
||||
Some(crate::types::NotificationType::Error(err.kind)),
|
||||
));
|
||||
context.replies.push_back(UIEvent::Notification {
|
||||
title: Some("Could not perform search".into()),
|
||||
source: None,
|
||||
body: err.to_string().into(),
|
||||
kind: Some(crate::types::NotificationType::Error(err.kind)),
|
||||
});
|
||||
}
|
||||
};
|
||||
self.set_dirty(true);
|
||||
|
@ -1538,19 +1489,6 @@ impl Component for ConversationsListing {
|
|||
}
|
||||
_ => {}
|
||||
},
|
||||
UIEvent::Input(Key::Esc)
|
||||
if !self.unfocused()
|
||||
&& self
|
||||
.rows
|
||||
.selection
|
||||
.values()
|
||||
.cloned()
|
||||
.any(std::convert::identity) =>
|
||||
{
|
||||
self.rows.clear_selection();
|
||||
self.set_dirty(true);
|
||||
return true;
|
||||
}
|
||||
UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Char(''))
|
||||
if !self.unfocused() && !&self.filter_term.is_empty() =>
|
||||
{
|
||||
|
@ -1572,15 +1510,35 @@ impl Component for ConversationsListing {
|
|||
Ok(None) => { /* something happened, perhaps a worker thread panicked */ }
|
||||
Ok(Some(Ok(results))) => self.filter(filter_term, results, context),
|
||||
Ok(Some(Err(err))) => {
|
||||
context.replies.push_back(UIEvent::Notification(
|
||||
Some("Could not perform search".to_string()),
|
||||
err.to_string(),
|
||||
Some(crate::types::NotificationType::Error(err.kind)),
|
||||
));
|
||||
context.replies.push_back(UIEvent::Notification {
|
||||
title: Some("Could not perform search".into()),
|
||||
source: None,
|
||||
body: err.to_string().into(),
|
||||
kind: Some(crate::types::NotificationType::Error(err.kind)),
|
||||
});
|
||||
}
|
||||
}
|
||||
self.set_dirty(true);
|
||||
}
|
||||
UIEvent::Input(ref key)
|
||||
if context
|
||||
.settings
|
||||
.shortcuts
|
||||
.listing
|
||||
.commands
|
||||
.iter()
|
||||
.any(|cmd| {
|
||||
if cmd.shortcut == *key {
|
||||
for cmd in &cmd.command {
|
||||
context.replies.push_back(UIEvent::Command(cmd.to_string()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}) =>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
@ -1589,8 +1547,9 @@ impl Component for ConversationsListing {
|
|||
|
||||
fn is_dirty(&self) -> bool {
|
||||
match self.focus {
|
||||
Focus::None => self.dirty,
|
||||
Focus::Entry => self.dirty,
|
||||
Focus::None | Focus::Entry => {
|
||||
self.dirty || self.force_draw || !self.rows.row_updates.is_empty()
|
||||
}
|
||||
Focus::EntryFullscreen => false,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ impl std::fmt::Display for OfflineListing {
|
|||
|
||||
impl OfflineListing {
|
||||
pub fn new(cursor_pos: (AccountHash, MailboxHash)) -> Box<Self> {
|
||||
Box::new(OfflineListing {
|
||||
Box::new(Self {
|
||||
cursor_pos,
|
||||
_row_updates: SmallVec::new(),
|
||||
_selection: HashMap::default(),
|
||||
|
@ -139,52 +139,50 @@ impl Component for OfflineListing {
|
|||
let theme_default = conf::value(context, "theme_default");
|
||||
let text_unfocused = conf::value(context, "text.unfocused");
|
||||
let error_message = conf::value(context, "error_message");
|
||||
clear_area(grid, area, theme_default);
|
||||
grid.clear_area(area, theme_default);
|
||||
if let Err(err) = context.is_online(self.cursor_pos.0) {
|
||||
let (x, _) = write_string_to_grid(
|
||||
let (x, _) = grid.write_string(
|
||||
"offline: ",
|
||||
grid,
|
||||
error_message.fg,
|
||||
error_message.bg,
|
||||
error_message.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
write_string_to_grid(
|
||||
|
||||
let (_, mut y_offset) = grid.write_string(
|
||||
&err.to_string(),
|
||||
grid,
|
||||
error_message.fg,
|
||||
error_message.bg,
|
||||
error_message.attrs,
|
||||
(set_x(upper_left!(area), x + 1), bottom_right!(area)),
|
||||
Some(get_x(upper_left!(area))),
|
||||
area.skip_cols(x + 1),
|
||||
Some(0),
|
||||
);
|
||||
y_offset += 1;
|
||||
if let Some(msg) = self.messages.last() {
|
||||
write_string_to_grid(
|
||||
grid.write_string(
|
||||
msg,
|
||||
grid,
|
||||
text_unfocused.fg,
|
||||
text_unfocused.bg,
|
||||
Attr::BOLD,
|
||||
(pos_inc((0, 1), upper_left!(area)), bottom_right!(area)),
|
||||
area.skip_rows(y_offset),
|
||||
None,
|
||||
);
|
||||
}
|
||||
y_offset += 1;
|
||||
for (i, msg) in self.messages.iter().rev().skip(1).enumerate() {
|
||||
write_string_to_grid(
|
||||
grid.write_string(
|
||||
msg,
|
||||
grid,
|
||||
text_unfocused.fg,
|
||||
text_unfocused.bg,
|
||||
text_unfocused.attrs,
|
||||
(pos_inc((0, 2 + i), upper_left!(area)), bottom_right!(area)),
|
||||
area.skip_rows(y_offset + i),
|
||||
None,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
let (_, mut y) = write_string_to_grid(
|
||||
grid.write_string(
|
||||
"loading...",
|
||||
grid,
|
||||
conf::value(context, "highlight").fg,
|
||||
conf::value(context, "highlight").bg,
|
||||
conf::value(context, "highlight").attrs,
|
||||
|
@ -196,17 +194,15 @@ impl Component for OfflineListing {
|
|||
.iter()
|
||||
.collect();
|
||||
jobs.sort_by_key(|(j, _)| *j);
|
||||
for (job_id, j) in jobs {
|
||||
write_string_to_grid(
|
||||
for (i, (job_id, j)) in jobs.into_iter().enumerate() {
|
||||
grid.write_string(
|
||||
&format!("{}: {:?}", job_id, j),
|
||||
grid,
|
||||
text_unfocused.fg,
|
||||
text_unfocused.bg,
|
||||
text_unfocused.attrs,
|
||||
(set_y(upper_left!(area), y + 1), bottom_right!(area)),
|
||||
area.skip_rows(i + 1),
|
||||
None,
|
||||
);
|
||||
y += 1;
|
||||
}
|
||||
|
||||
context
|
||||
|
@ -224,7 +220,13 @@ impl Component for OfflineListing {
|
|||
if let Some(msg) = msg.clone() {
|
||||
self.messages.push(msg);
|
||||
}
|
||||
self.dirty = true
|
||||
self.set_dirty(true);
|
||||
}
|
||||
UIEvent::ChangeMode(UIMode::Normal)
|
||||
| UIEvent::Resize
|
||||
| UIEvent::ConfigReload { old_settings: _ }
|
||||
| UIEvent::VisibilityChange(_) => {
|
||||
self.set_dirty(true);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -141,13 +141,13 @@ pub fn encrypt_filter(
|
|||
Default::default(),
|
||||
ctx.encrypt(sign_keys, encrypt_keys, data)?.await?,
|
||||
);
|
||||
a.content_disposition = ContentDisposition::from(r#"attachment; filename="msg.asc""#.as_bytes());
|
||||
a.content_disposition = ContentDisposition::from(br#"attachment; filename="msg.asc""#);
|
||||
a
|
||||
};
|
||||
let mut a: AttachmentBuilder = AttachmentBuilder::new("Version: 1\n".as_bytes());
|
||||
let mut a: AttachmentBuilder = AttachmentBuilder::new(b"Version: 1\n");
|
||||
|
||||
a.set_content_type_from_bytes("application/pgp-encrypted".as_bytes());
|
||||
a.set_content_disposition(ContentDisposition::from("attachment".as_bytes()));
|
||||
a.set_content_type_from_bytes(b"application/pgp-encrypted");
|
||||
a.set_content_disposition(ContentDisposition::from(b"attachment"));
|
||||
let parts = vec![a, sig_attachment.into()];
|
||||
let boundary = ContentType::make_boundary(&parts);
|
||||
Ok(Attachment::new(
|
||||
|
|
|
@ -19,15 +19,18 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
use melib::{MailBackendExtensionStatus, SpecialUsageMailbox};
|
||||
|
||||
use super::*;
|
||||
use crate::accounts::JobRequest;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct AccountStatus {
|
||||
cursor: (usize, usize),
|
||||
account_pos: usize,
|
||||
content: CellBuffer,
|
||||
content: Screen<Virtual>,
|
||||
dirty: bool,
|
||||
theme_default: ThemeAttribute,
|
||||
id: ComponentId,
|
||||
|
@ -40,7 +43,7 @@ impl std::fmt::Display for AccountStatus {
|
|||
}
|
||||
|
||||
impl AccountStatus {
|
||||
pub fn new(account_pos: usize, theme_default: ThemeAttribute) -> AccountStatus {
|
||||
pub fn new(account_pos: usize, theme_default: ThemeAttribute) -> Self {
|
||||
let default_cell = {
|
||||
let mut ret = Cell::with_char(' ');
|
||||
ret.set_fg(theme_default.fg)
|
||||
|
@ -48,10 +51,12 @@ impl AccountStatus {
|
|||
.set_attrs(theme_default.attrs);
|
||||
ret
|
||||
};
|
||||
let mut content = CellBuffer::new(120, 5, default_cell);
|
||||
content.set_growable(true);
|
||||
let mut content = Screen::<Virtual>::new();
|
||||
content.grid_mut().default_cell = default_cell;
|
||||
content.grid_mut().set_growable(true);
|
||||
_ = content.resize(80, 20);
|
||||
|
||||
AccountStatus {
|
||||
Self {
|
||||
cursor: (0, 0),
|
||||
account_pos,
|
||||
content,
|
||||
|
@ -60,58 +65,51 @@ impl AccountStatus {
|
|||
id: ComponentId::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for AccountStatus {
|
||||
fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
if !self.dirty {
|
||||
fn update_content(&mut self, (width, height): (usize, usize), context: &Context) {
|
||||
if !self.content.resize_with_context(width, height, context) {
|
||||
return;
|
||||
}
|
||||
self.dirty = false;
|
||||
let (mut width, _) = self.content.size();
|
||||
let a = &context.accounts[self.account_pos];
|
||||
let (_x, _y) = write_string_to_grid(
|
||||
let area = self.content.area().skip_cols(1);
|
||||
let (_x, _y) = self.content.grid_mut().write_string(
|
||||
"Account ",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs | Attr::UNDERLINE,
|
||||
((1, 0), (width - 1, 0)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
let (_x, _y) = write_string_to_grid(
|
||||
let area = self.content.area().skip(_x + 1, _y);
|
||||
let (_x, _y) = self.content.grid_mut().write_string(
|
||||
a.name(),
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
Attr::BOLD | Attr::UNDERLINE,
|
||||
((_x, _y), (width - 1, _y)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
width = self.content.size().0;
|
||||
let mut line = 2;
|
||||
|
||||
write_string_to_grid(
|
||||
let area = self.content.area().skip(1, line);
|
||||
self.content.grid_mut().write_string(
|
||||
"In-progress jobs:",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
Attr::BOLD,
|
||||
((1, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
line += 2;
|
||||
|
||||
for (job_id, req) in a.active_jobs.iter() {
|
||||
width = self.content.size().0;
|
||||
use crate::accounts::JobRequest;
|
||||
let (x, y) = write_string_to_grid(
|
||||
let area = self.content.area().skip(1, line);
|
||||
let (x, y) = self.content.grid_mut().write_string(
|
||||
&format!("{} {}", req, job_id),
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((1, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
if let JobRequest::DeleteMailbox { mailbox_hash, .. }
|
||||
|
@ -120,13 +118,13 @@ impl Component for AccountStatus {
|
|||
| JobRequest::Refresh { mailbox_hash, .. }
|
||||
| JobRequest::Fetch { mailbox_hash, .. } = req
|
||||
{
|
||||
write_string_to_grid(
|
||||
let area = self.content.area().skip(x + 1, y + line);
|
||||
self.content.grid_mut().write_string(
|
||||
a.mailbox_entries[mailbox_hash].name(),
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((x + 1, y), (width - 1, y)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
@ -135,80 +133,77 @@ impl Component for AccountStatus {
|
|||
}
|
||||
|
||||
line += 2;
|
||||
width = self.content.size().0;
|
||||
|
||||
let (_x, _y) = write_string_to_grid(
|
||||
let area = self.content.area().skip(1, line);
|
||||
let (_x, _y) = self.content.grid_mut().write_string(
|
||||
"Tag support: ",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
Attr::BOLD,
|
||||
((1, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
width = self.content.size().0;
|
||||
write_string_to_grid(
|
||||
let area = self.content.area().skip(_x + 1, _y + line);
|
||||
self.content.grid_mut().write_string(
|
||||
if a.backend_capabilities.supports_tags {
|
||||
"yes"
|
||||
} else {
|
||||
"no"
|
||||
},
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((_x, _y), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
width = self.content.size().0;
|
||||
line += 1;
|
||||
let (_x, _y) = write_string_to_grid(
|
||||
let area = self.content.area().skip(1, line);
|
||||
let (_x, _y) = self.content.grid_mut().write_string(
|
||||
"Search backend: ",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
Attr::BOLD,
|
||||
((1, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
width = self.content.size().0;
|
||||
write_string_to_grid(
|
||||
let area = self.content.area().skip(_x + 1, _y + line);
|
||||
self.content.grid_mut().write_string(
|
||||
&match (
|
||||
a.settings.conf.search_backend(),
|
||||
a.backend_capabilities.supports_search,
|
||||
) {
|
||||
(SearchBackend::Auto, true) | (SearchBackend::None, true) => {
|
||||
"backend-side search".to_string()
|
||||
Cow::Borrowed("backend-side search")
|
||||
}
|
||||
(SearchBackend::Auto, false) | (SearchBackend::None, false) => {
|
||||
"none (search will be slow)".to_string()
|
||||
Cow::Borrowed("none (search will be slow)")
|
||||
}
|
||||
#[cfg(feature = "sqlite3")]
|
||||
(SearchBackend::Sqlite3, _) => {
|
||||
if let Ok(path) = crate::sqlite3::db_path() {
|
||||
format!("sqlite3 database {}", path.display())
|
||||
} else {
|
||||
"sqlite3 database".to_string()
|
||||
match crate::sqlite3::AccountCache::db_path(&a.name) {
|
||||
Ok(Some(path)) => {
|
||||
Cow::Owned(format!("sqlite3 database: {}", path.display()))
|
||||
}
|
||||
Ok(None) => Cow::Borrowed("sqlite3 database: uninitialized"),
|
||||
Err(err) => Cow::Owned(format!("sqlite3 error: {err}")),
|
||||
}
|
||||
}
|
||||
},
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((_x, _y), (width - 1, _y)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
width = self.content.size().0;
|
||||
line += 1;
|
||||
|
||||
write_string_to_grid(
|
||||
let area = self.content.area().skip(1, line);
|
||||
self.content.grid_mut().write_string(
|
||||
"Special Mailboxes:",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
Attr::BOLD,
|
||||
((1, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
for f in a
|
||||
|
@ -217,41 +212,38 @@ impl Component for AccountStatus {
|
|||
.map(|entry| &entry.ref_mailbox)
|
||||
.filter(|f| f.special_usage() != SpecialUsageMailbox::Normal)
|
||||
{
|
||||
width = self.content.size().0;
|
||||
line += 1;
|
||||
write_string_to_grid(
|
||||
let area = self.content.area().skip(1, line);
|
||||
self.content.grid_mut().write_string(
|
||||
&format!("{}: {}", f.path(), f.special_usage()),
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((1, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
line += 2;
|
||||
width = self.content.size().0;
|
||||
write_string_to_grid(
|
||||
let area = self.content.area().skip(1, line);
|
||||
self.content.grid_mut().write_string(
|
||||
"Subscribed mailboxes:",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
Attr::BOLD,
|
||||
((1, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
line += 2;
|
||||
for mailbox_node in a.list_mailboxes() {
|
||||
width = self.content.size().0;
|
||||
let f: &Mailbox = &a[&mailbox_node.hash].ref_mailbox;
|
||||
if f.is_subscribed() {
|
||||
write_string_to_grid(
|
||||
let area = self.content.area().skip(1, line);
|
||||
self.content.grid_mut().write_string(
|
||||
f.path(),
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((1, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
line += 1;
|
||||
|
@ -259,15 +251,14 @@ impl Component for AccountStatus {
|
|||
}
|
||||
|
||||
line += 1;
|
||||
width = self.content.size().0;
|
||||
if let Some(ref extensions) = a.backend_capabilities.extensions {
|
||||
write_string_to_grid(
|
||||
let area = self.content.area().skip(1, line);
|
||||
self.content.grid_mut().write_string(
|
||||
"Server Extensions:",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
Attr::BOLD,
|
||||
((1, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
let max_name_width = std::cmp::max(
|
||||
|
@ -278,89 +269,92 @@ impl Component for AccountStatus {
|
|||
.max()
|
||||
.unwrap_or(0),
|
||||
);
|
||||
width = self.content.size().0;
|
||||
write_string_to_grid(
|
||||
let area = self.content.area().skip(max_name_width + 6, line);
|
||||
self.content.grid_mut().write_string(
|
||||
"meli support:",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((max_name_width + 6, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
line += 1;
|
||||
for (name, status) in extensions.iter() {
|
||||
width = self.content.size().0;
|
||||
write_string_to_grid(
|
||||
let area = self.content.area().skip(1, line);
|
||||
self.content.grid_mut().write_string(
|
||||
name.trim_at_boundary(30),
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((1, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
|
||||
width = self.content.size().0;
|
||||
let (x, y) = match status {
|
||||
MailBackendExtensionStatus::Unsupported { comment: _ } => write_string_to_grid(
|
||||
"not supported",
|
||||
&mut self.content,
|
||||
Color::Red,
|
||||
let (x, y) = {
|
||||
let (status, color) = match status {
|
||||
MailBackendExtensionStatus::Unsupported { comment: _ } => {
|
||||
("not supported", Color::Red)
|
||||
}
|
||||
MailBackendExtensionStatus::Supported { comment: _ } => {
|
||||
("supported", Color::Green)
|
||||
}
|
||||
MailBackendExtensionStatus::Enabled { comment: _ } => {
|
||||
("enabled", Color::Green)
|
||||
}
|
||||
};
|
||||
let area = self.content.area().skip(max_name_width + 6, line);
|
||||
self.content.grid_mut().write_string(
|
||||
status,
|
||||
color,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((max_name_width + 6, line), (width - 1, line)),
|
||||
area,
|
||||
None,
|
||||
),
|
||||
MailBackendExtensionStatus::Supported { comment: _ } => write_string_to_grid(
|
||||
"supported",
|
||||
&mut self.content,
|
||||
Color::Green,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((max_name_width + 6, line), (width - 1, line)),
|
||||
None,
|
||||
),
|
||||
MailBackendExtensionStatus::Enabled { comment: _ } => write_string_to_grid(
|
||||
"enabled",
|
||||
&mut self.content,
|
||||
Color::Green,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((max_name_width + 6, line), (width - 1, line)),
|
||||
None,
|
||||
),
|
||||
)
|
||||
};
|
||||
match status {
|
||||
MailBackendExtensionStatus::Unsupported { comment }
|
||||
| MailBackendExtensionStatus::Supported { comment }
|
||||
| MailBackendExtensionStatus::Enabled { comment } => {
|
||||
if let Some(s) = comment {
|
||||
let (x, y) = write_string_to_grid(
|
||||
let area = self
|
||||
.content
|
||||
.area()
|
||||
.skip(max_name_width + 6, line)
|
||||
.skip(x, y);
|
||||
let (_x, _y) = self.content.grid_mut().write_string(
|
||||
" (",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((x, y), (width - 1, y)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
let (x, y) = write_string_to_grid(
|
||||
let area = self
|
||||
.content
|
||||
.area()
|
||||
.skip(max_name_width + 6, line)
|
||||
.skip(x, y)
|
||||
.skip(_x, _y);
|
||||
let (__x, __y) = self.content.grid_mut().write_string(
|
||||
s,
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((x, y), (width - 1, y)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
write_string_to_grid(
|
||||
let area = self
|
||||
.content
|
||||
.area()
|
||||
.skip(max_name_width + 6, line)
|
||||
.skip(x + _x + __x, y + _y + __y);
|
||||
self.content.grid_mut().write_string(
|
||||
")",
|
||||
&mut self.content,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((x, y), (width - 1, y)),
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
@ -369,30 +363,34 @@ impl Component for AccountStatus {
|
|||
line += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* self.content may have been resized with write_string_to_grid() calls above
|
||||
impl Component for AccountStatus {
|
||||
fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
if !self.dirty {
|
||||
return;
|
||||
}
|
||||
self.dirty = false;
|
||||
self.update_content(area.size(), context);
|
||||
|
||||
/* self.content may have been resized with write_string() calls above
|
||||
* since it has growable set */
|
||||
let (width, height) = self.content.size();
|
||||
let (cols, rows) = (width!(area), height!(area));
|
||||
let (width, height) = self.content.area().size();
|
||||
let (cols, rows) = area.size();
|
||||
self.cursor = (
|
||||
std::cmp::min(width.saturating_sub(cols), self.cursor.0),
|
||||
std::cmp::min(height.saturating_sub(rows), self.cursor.1),
|
||||
);
|
||||
clear_area(grid, area, self.theme_default);
|
||||
copy_area(
|
||||
grid,
|
||||
&self.content,
|
||||
grid.clear_area(area, self.theme_default);
|
||||
|
||||
grid.copy_area(
|
||||
self.content.grid(),
|
||||
area,
|
||||
(
|
||||
(
|
||||
std::cmp::min((width - 1).saturating_sub(cols), self.cursor.0),
|
||||
std::cmp::min((height - 1).saturating_sub(rows), self.cursor.1),
|
||||
),
|
||||
(
|
||||
std::cmp::min(self.cursor.0 + cols, width - 1),
|
||||
std::cmp::min(self.cursor.1 + rows, height - 1),
|
||||
),
|
||||
),
|
||||
self.content
|
||||
.area()
|
||||
.skip(self.cursor.0, self.cursor.1)
|
||||
.take(cols, rows),
|
||||
);
|
||||
context.dirty_areas.push_back(area);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ use std::{
|
|||
|
||||
use melib::{
|
||||
email::attachment_types::ContentType, list_management, mailto::Mailto, parser::BytesExt,
|
||||
utils::datetime, Card, Draft, HeaderName, SpecialUsageMailbox,
|
||||
utils::datetime, Card, Draft, FlagOp, HeaderName, SpecialUsageMailbox,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
|
@ -39,8 +39,6 @@ use crate::{accounts::JobRequest, jobs::JobId};
|
|||
mod utils;
|
||||
pub use utils::*;
|
||||
|
||||
mod html;
|
||||
pub use html::*;
|
||||
mod thread;
|
||||
pub use thread::*;
|
||||
mod types;
|
||||
|
@ -51,6 +49,12 @@ use state::*;
|
|||
pub mod envelope;
|
||||
pub use envelope::EnvelopeView;
|
||||
|
||||
pub mod filters;
|
||||
pub use filters::*;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
/// Contains an Envelope view, with sticky headers, a pager for the body, and
|
||||
/// subviews for more menus
|
||||
#[derive(Debug)]
|
||||
|
@ -90,7 +94,7 @@ impl MailView {
|
|||
initialize_now: bool,
|
||||
context: &mut Context,
|
||||
) -> Self {
|
||||
let mut ret = MailView {
|
||||
let mut ret = Self {
|
||||
coordinates,
|
||||
dirty: true,
|
||||
contact_selector: None,
|
||||
|
@ -256,7 +260,7 @@ impl MailView {
|
|||
}
|
||||
let envelope: EnvelopeRef = account.collection.get_env(coordinates.2);
|
||||
|
||||
let mut entries = Vec::new();
|
||||
let mut entries: IndexMap<Card, (Card, String)> = IndexMap::default();
|
||||
for addr in envelope.from().iter().chain(envelope.to().iter()) {
|
||||
let mut new_card: Card = Card::new();
|
||||
new_card
|
||||
|
@ -265,12 +269,12 @@ impl MailView {
|
|||
if let Some(display_name) = addr.get_display_name() {
|
||||
new_card.set_name(display_name);
|
||||
}
|
||||
entries.push((new_card, format!("{}", addr)));
|
||||
entries.insert(new_card.clone(), (new_card, format!("{}", addr)));
|
||||
}
|
||||
drop(envelope);
|
||||
self.contact_selector = Some(Box::new(Selector::new(
|
||||
"select contacts to add",
|
||||
entries,
|
||||
entries.into_iter().map(|(_, v)| v).collect(),
|
||||
false,
|
||||
Some(Box::new(move |id: ComponentId, results: &[Card]| {
|
||||
Some(UIEvent::FinishedUIDialog(id, Box::new(results.to_vec())))
|
||||
|
@ -310,49 +314,34 @@ impl Component for MailView {
|
|||
{
|
||||
let account = &mut context.accounts[&coordinates.0];
|
||||
if !account.collection.get_env(coordinates.2).is_seen() {
|
||||
let job = account.backend.write().unwrap().set_flags(
|
||||
if let Err(err) = account.set_flags(
|
||||
coordinates.2.into(),
|
||||
coordinates.1,
|
||||
smallvec::smallvec![(Ok(Flag::SEEN), true)],
|
||||
);
|
||||
match job {
|
||||
Ok(fut) => {
|
||||
let handle = account
|
||||
.main_loop_handler
|
||||
.job_executor
|
||||
.spawn_specialized("set_flags".into(), fut);
|
||||
account.insert_job(
|
||||
handle.job_id,
|
||||
JobRequest::SetFlags {
|
||||
env_hashes: coordinates.2.into(),
|
||||
handle,
|
||||
},
|
||||
);
|
||||
}
|
||||
Err(err) => {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
StatusEvent::DisplayMessage(format!(
|
||||
"Could not set message as seen: {err}",
|
||||
)),
|
||||
));
|
||||
}
|
||||
smallvec::smallvec![FlagOp::Set(Flag::SEEN)],
|
||||
) {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
StatusEvent::DisplayMessage(format!(
|
||||
"Could not set message as seen: {err}",
|
||||
)),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
env_view.draw(grid, area, context);
|
||||
} else if let MailViewState::Error { ref err } = self.state {
|
||||
clear_area(grid, area, self.theme_default);
|
||||
grid.clear_area(area, self.theme_default);
|
||||
context.dirty_areas.push_back(area);
|
||||
context.replies.push_back(UIEvent::Notification(
|
||||
Some("Failed to open e-mail".to_string()),
|
||||
err.to_string(),
|
||||
Some(NotificationType::Error(err.kind)),
|
||||
));
|
||||
context.replies.push_back(UIEvent::Notification {
|
||||
title: Some("Failed to open e-mail".into()),
|
||||
source: None,
|
||||
body: err.to_string().into(),
|
||||
kind: Some(NotificationType::Error(err.kind)),
|
||||
});
|
||||
log::error!("Failed to open envelope: {err}");
|
||||
self.init_futures(context);
|
||||
return;
|
||||
} else {
|
||||
clear_area(grid, area, self.theme_default);
|
||||
grid.clear_area(area, self.theme_default);
|
||||
context.dirty_areas.push_back(area);
|
||||
return;
|
||||
};
|
||||
|
@ -367,6 +356,7 @@ impl Component for MailView {
|
|||
|
||||
fn process_event(&mut self, mut event: &mut UIEvent, context: &mut Context) -> bool {
|
||||
if let Some(ref mut s) = self.contact_selector {
|
||||
// [ref:FIXME]: contact_selector should not forward navigation events and return true
|
||||
if s.process_event(event, context) {
|
||||
return true;
|
||||
}
|
||||
|
@ -510,7 +500,7 @@ impl Component for MailView {
|
|||
move |id: ComponentId, result: &[Option<PendingReplyAction>]| {
|
||||
Some(UIEvent::FinishedUIDialog(
|
||||
id,
|
||||
Box::new(result.get(0).cloned().flatten()),
|
||||
Box::new(result.first().cloned().flatten()),
|
||||
))
|
||||
},
|
||||
)),
|
||||
|
@ -591,11 +581,12 @@ impl Component for MailView {
|
|||
err
|
||||
);
|
||||
log::error!("{err_string}");
|
||||
context.replies.push_back(UIEvent::Notification(
|
||||
Some("Failed to open e-mail".to_string()),
|
||||
err_string,
|
||||
Some(NotificationType::Error(err.kind)),
|
||||
));
|
||||
context.replies.push_back(UIEvent::Notification {
|
||||
title: Some("Failed to open e-mail".into()),
|
||||
source: None,
|
||||
body: err_string.into(),
|
||||
kind: Some(NotificationType::Error(err.kind)),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -675,7 +666,7 @@ impl Component for MailView {
|
|||
/* autosend or open unsubscribe option */
|
||||
let unsubscribe = actions.unsubscribe.as_ref().unwrap();
|
||||
for option in unsubscribe.iter() {
|
||||
/* [ref:TODO]: Ask for confirmation before proceding with an action */
|
||||
/* [ref:TODO]: Ask for confirmation before proceeding with an action */
|
||||
match option {
|
||||
list_management::ListAction::Email(email) => {
|
||||
if let Ok(mailto) = Mailto::try_from(*email) {
|
||||
|
@ -685,7 +676,8 @@ impl Component for MailView {
|
|||
context.accounts[&coordinates.0]
|
||||
.settings
|
||||
.account()
|
||||
.make_display_name(),
|
||||
.make_display_name()
|
||||
.to_string(),
|
||||
);
|
||||
/* Manually drop stuff because borrowck doesn't do it
|
||||
* on its own */
|
||||
|
@ -735,12 +727,16 @@ impl Component for MailView {
|
|||
.spawn()
|
||||
{
|
||||
Ok(child) => {
|
||||
context.children.push(child);
|
||||
context
|
||||
.children
|
||||
.entry(url_launcher.to_string().into())
|
||||
.or_default()
|
||||
.push(child);
|
||||
}
|
||||
Err(err) => {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
StatusEvent::DisplayMessage(format!(
|
||||
"Couldn't launch {:?}: {}",
|
||||
"Couldn't launch {}: {}",
|
||||
url_launcher, err
|
||||
)),
|
||||
));
|
||||
|
@ -775,11 +771,15 @@ impl Component for MailView {
|
|||
.stdout(Stdio::piped())
|
||||
.spawn()
|
||||
{
|
||||
Ok(child) => context.children.push(child),
|
||||
Ok(child) => context
|
||||
.children
|
||||
.entry(url_launcher.to_string().into())
|
||||
.or_default()
|
||||
.push(child),
|
||||
Err(err) => {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
StatusEvent::DisplayMessage(format!(
|
||||
"Couldn't launch {:?}: {}",
|
||||
"Couldn't launch {}: {}",
|
||||
url_launcher, err
|
||||
)),
|
||||
));
|
||||
|
@ -799,6 +799,25 @@ impl Component for MailView {
|
|||
.push_back(UIEvent::Action(Tab(New(Some(Box::new(new_tab))))));
|
||||
return true;
|
||||
}
|
||||
UIEvent::Input(ref key)
|
||||
if context
|
||||
.settings
|
||||
.shortcuts
|
||||
.envelope_view
|
||||
.commands
|
||||
.iter()
|
||||
.any(|cmd| {
|
||||
if cmd.shortcut == *key {
|
||||
for cmd in &cmd.command {
|
||||
context.replies.push_back(UIEvent::Command(cmd.to_string()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}) =>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
false
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,395 @@
|
|||
/*
|
||||
* meli
|
||||
*
|
||||
* Copyright 2023 Manos Pitsidianakis
|
||||
*
|
||||
* This file is part of meli.
|
||||
*
|
||||
* meli is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* meli is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
io::Write,
|
||||
process::{Command, Stdio},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
type ProcessEventFn = fn(&mut ViewFilter, &mut UIEvent, &mut Context) -> bool;
|
||||
|
||||
use melib::{
|
||||
attachment_types::{ContentType, MultipartType, Text},
|
||||
error::*,
|
||||
parser::BytesExt,
|
||||
text::Truncate,
|
||||
utils::xdg::query_default_app,
|
||||
Attachment, Result,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
components::*,
|
||||
desktop_exec_to_command,
|
||||
terminal::{Area, CellBuffer},
|
||||
Context, ErrorKind, File, StatusEvent, UIEvent,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ViewFilter {
|
||||
pub filter_invocation: String,
|
||||
pub content_type: ContentType,
|
||||
pub notice: Option<Cow<'static, str>>,
|
||||
pub body_text: String,
|
||||
pub unfiltered: Vec<u8>,
|
||||
pub event_handler: Option<ProcessEventFn>,
|
||||
pub id: ComponentId,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for ViewFilter {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
fmt.debug_struct(stringify!(ViewFilter))
|
||||
.field("filter_invocation", &self.filter_invocation)
|
||||
.field("content_type", &self.content_type)
|
||||
.field("notice", &self.notice)
|
||||
.field("body_text", &self.body_text.trim_at_boundary(18))
|
||||
.field("body_text_len", &self.body_text.len())
|
||||
.field("event_handler", &self.event_handler.is_some())
|
||||
.field("id", &self.id)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ViewFilter {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(fmt, "{}", self.filter_invocation.trim_at_boundary(5))
|
||||
}
|
||||
}
|
||||
|
||||
impl ViewFilter {
|
||||
pub fn new_html(body: &Attachment, context: &Context) -> Result<Self> {
|
||||
fn run(cmd: &str, args: &[&str], bytes: &[u8]) -> Result<String> {
|
||||
let mut html_filter = Command::new(cmd)
|
||||
.args(args)
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()?;
|
||||
html_filter
|
||||
.stdin
|
||||
.as_mut()
|
||||
.ok_or("Failed to write to html filter stdin")?
|
||||
.write_all(bytes)
|
||||
.chain_err_summary(|| "Failed to write to html filter stdin")?;
|
||||
Ok(String::from_utf8_lossy(
|
||||
&html_filter
|
||||
.wait_with_output()
|
||||
.chain_err_summary(|| "Could not wait for process output")?
|
||||
.stdout,
|
||||
)
|
||||
.into())
|
||||
}
|
||||
|
||||
let mut att = body;
|
||||
let mut stack = vec![body];
|
||||
while let Some(a) = stack.pop() {
|
||||
match a.content_type {
|
||||
ContentType::Text {
|
||||
kind: Text::Html, ..
|
||||
} => {
|
||||
att = a;
|
||||
break;
|
||||
}
|
||||
ContentType::Text { .. }
|
||||
| ContentType::PGPSignature
|
||||
| ContentType::CMSSignature => {
|
||||
continue;
|
||||
}
|
||||
ContentType::Multipart {
|
||||
kind: MultipartType::Related,
|
||||
ref parts,
|
||||
ref parameters,
|
||||
..
|
||||
} => {
|
||||
if let Some(main_attachment) = parameters
|
||||
.iter()
|
||||
.find_map(|(k, v)| if k == b"type" { Some(v) } else { None })
|
||||
.and_then(|t| parts.iter().find(|a| a.content_type == t.as_slice()))
|
||||
{
|
||||
stack.push(main_attachment);
|
||||
} else {
|
||||
for a in parts {
|
||||
if let ContentType::Text {
|
||||
kind: Text::Html, ..
|
||||
} = a.content_type
|
||||
{
|
||||
att = a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
stack.extend(parts);
|
||||
}
|
||||
}
|
||||
ContentType::Multipart {
|
||||
kind: MultipartType::Alternative,
|
||||
ref parts,
|
||||
..
|
||||
} => {
|
||||
for a in parts {
|
||||
if let ContentType::Text {
|
||||
kind: Text::Html, ..
|
||||
} = a.content_type
|
||||
{
|
||||
att = a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
stack.extend(parts);
|
||||
}
|
||||
ContentType::Multipart {
|
||||
kind: _, ref parts, ..
|
||||
} => {
|
||||
for a in parts {
|
||||
if let ContentType::Text {
|
||||
kind: Text::Html, ..
|
||||
} = a.content_type
|
||||
{
|
||||
att = a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
stack.extend(parts);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let bytes: Vec<u8> = att.decode(Default::default());
|
||||
|
||||
let settings = &context.settings;
|
||||
if let Some(filter_invocation) = settings.pager.html_filter.as_ref() {
|
||||
match run("sh", &["-c", filter_invocation], &bytes) {
|
||||
Err(err) => {
|
||||
return Err(Error::new(format!(
|
||||
"Failed to start html filter process `{}`",
|
||||
filter_invocation,
|
||||
))
|
||||
.set_source(Some(Arc::new(err)))
|
||||
.set_kind(ErrorKind::External));
|
||||
}
|
||||
Ok(body_text) => {
|
||||
let notice =
|
||||
Some(format!("Text piped through `{}`.\n\n", filter_invocation).into());
|
||||
return Ok(Self {
|
||||
filter_invocation: filter_invocation.clone(),
|
||||
content_type: att.content_type.clone(),
|
||||
notice,
|
||||
body_text,
|
||||
unfiltered: bytes,
|
||||
event_handler: Some(Self::html_process_event),
|
||||
id: ComponentId::default(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Ok(body_text) = run("w3m", &["-I", "utf-8", "-T", "text/html"], &bytes) {
|
||||
return Ok(Self {
|
||||
filter_invocation: "w3m -I utf-8 -T text/html".into(),
|
||||
content_type: att.content_type.clone(),
|
||||
notice: Some("Text piped through `w3m -I utf-8 -T text/html`.\n\n".into()),
|
||||
body_text,
|
||||
unfiltered: bytes,
|
||||
event_handler: Some(Self::html_process_event),
|
||||
id: ComponentId::default(),
|
||||
});
|
||||
}
|
||||
|
||||
Err(
|
||||
Error::new("Failed to find any application to use as html filter")
|
||||
.set_kind(ErrorKind::Configuration),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn new_attachment(att: &Attachment, context: &mut Context) -> Result<Self> {
|
||||
if matches!(
|
||||
att.content_type,
|
||||
ContentType::Other { .. } | ContentType::OctetStream { .. }
|
||||
) {
|
||||
return Err(Error::new(format!(
|
||||
"Cannot view {} attachment as text.",
|
||||
att.content_type,
|
||||
))
|
||||
.set_kind(ErrorKind::ValueError));
|
||||
}
|
||||
if let ContentType::Multipart {
|
||||
kind: MultipartType::Alternative,
|
||||
ref parts,
|
||||
..
|
||||
} = att.content_type
|
||||
{
|
||||
if let Some(Ok(v)) = parts
|
||||
.iter()
|
||||
.find(|p| p.is_text() && !p.body().trim().is_empty())
|
||||
.map(|p| Self::new_attachment(p, context))
|
||||
{
|
||||
return Ok(v);
|
||||
}
|
||||
} else if let ContentType::Multipart {
|
||||
kind: MultipartType::Related,
|
||||
ref parts,
|
||||
..
|
||||
} = att.content_type
|
||||
{
|
||||
if let Some(v @ Ok(_)) = parts.iter().find_map(|p| {
|
||||
if let v @ Ok(_) = Self::new_attachment(p, context) {
|
||||
Some(v)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
if att.is_html() {
|
||||
return Self::new_html(att, context);
|
||||
}
|
||||
if matches!(
|
||||
att.content_type,
|
||||
ContentType::Multipart {
|
||||
kind: MultipartType::Digest,
|
||||
..
|
||||
}
|
||||
) {
|
||||
return Ok(Self {
|
||||
filter_invocation: String::new(),
|
||||
content_type: att.content_type.clone(),
|
||||
notice: None,
|
||||
body_text: String::new(),
|
||||
unfiltered: vec![],
|
||||
event_handler: None,
|
||||
id: ComponentId::default(),
|
||||
});
|
||||
}
|
||||
if let ContentType::Multipart {
|
||||
kind: MultipartType::Mixed,
|
||||
ref parts,
|
||||
..
|
||||
} = att.content_type
|
||||
{
|
||||
if let Some(Ok(res)) =
|
||||
parts
|
||||
.iter()
|
||||
.find_map(|part| match Self::new_attachment(part, context) {
|
||||
v @ Ok(_) => Some(v),
|
||||
Err(_) => None,
|
||||
})
|
||||
{
|
||||
return Ok(res);
|
||||
}
|
||||
}
|
||||
let notice = Some("Viewing attachment.\n\n".into());
|
||||
Ok(Self {
|
||||
filter_invocation: String::new(),
|
||||
content_type: att.content_type.clone(),
|
||||
notice,
|
||||
body_text: att.text(),
|
||||
unfiltered: att.decode(Default::default()),
|
||||
event_handler: None,
|
||||
id: ComponentId::default(),
|
||||
})
|
||||
}
|
||||
|
||||
fn html_process_event(_self: &mut Self, event: &mut UIEvent, context: &mut Context) -> bool {
|
||||
if matches!(event, UIEvent::Input(key) if *key == context.settings.shortcuts.envelope_view.open_html)
|
||||
{
|
||||
let command = context
|
||||
.settings
|
||||
.pager
|
||||
.html_open
|
||||
.as_ref()
|
||||
.map(|s| s.to_string())
|
||||
.or_else(|| query_default_app("text/html").ok());
|
||||
let command = if cfg!(target_os = "macos") {
|
||||
command.or_else(|| Some("open".into()))
|
||||
} else if cfg!(target_os = "linux") {
|
||||
command.or_else(|| Some("xdg-open".into()))
|
||||
} else {
|
||||
command
|
||||
};
|
||||
if let Some(command) = command {
|
||||
let res = File::create_temp_file(&_self.unfiltered, None, None, Some("html"), true)
|
||||
.and_then(|p| {
|
||||
let exec_cmd = desktop_exec_to_command(
|
||||
&command,
|
||||
p.path().display().to_string(),
|
||||
false,
|
||||
);
|
||||
|
||||
Ok((
|
||||
p,
|
||||
Command::new("sh")
|
||||
.args(["-c", &exec_cmd])
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()?,
|
||||
))
|
||||
});
|
||||
match res {
|
||||
Ok((p, child)) => {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
StatusEvent::UpdateSubStatus(command.clone()),
|
||||
));
|
||||
context.temp_files.push(p);
|
||||
context
|
||||
.children
|
||||
.entry(command.into())
|
||||
.or_default()
|
||||
.push(child);
|
||||
}
|
||||
Err(err) => {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
StatusEvent::DisplayMessage(format!(
|
||||
"Failed to start `{command}`: {err}",
|
||||
)),
|
||||
));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
context
|
||||
.replies
|
||||
.push_back(UIEvent::StatusEvent(StatusEvent::DisplayMessage(
|
||||
"Couldn't find a default application for html files.".to_string(),
|
||||
)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for ViewFilter {
|
||||
fn draw(&mut self, _: &mut CellBuffer, _: Area, _: &mut Context) {}
|
||||
fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool {
|
||||
if let Some(ref mut f) = self.event_handler {
|
||||
return f(self, event, context);
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn is_dirty(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn set_dirty(&mut self, _: bool) {}
|
||||
|
||||
fn id(&self) -> ComponentId {
|
||||
self.id
|
||||
}
|
||||
}
|
|
@ -49,7 +49,7 @@ impl std::fmt::Debug for HtmlView {
|
|||
impl HtmlView {
|
||||
pub fn new(body: &Attachment, context: &mut Context) -> Self {
|
||||
let id = ComponentId::default();
|
||||
let bytes: Vec<u8> = body.decode_rec(Default::default());
|
||||
let bytes: Vec<u8> = body.decode(Default::default());
|
||||
|
||||
let settings = &context.settings;
|
||||
let mut display_text = if let Some(filter_invocation) = settings.pager.html_filter.as_ref()
|
||||
|
@ -61,14 +61,15 @@ impl HtmlView {
|
|||
.spawn();
|
||||
match command_obj {
|
||||
Err(err) => {
|
||||
context.replies.push_back(UIEvent::Notification(
|
||||
Some(format!(
|
||||
"Failed to start html filter process: {}",
|
||||
filter_invocation,
|
||||
)),
|
||||
err.to_string(),
|
||||
Some(NotificationType::Error(melib::ErrorKind::External)),
|
||||
));
|
||||
context.replies.push_back(UIEvent::Notification {
|
||||
title: Some(
|
||||
format!("Failed to start html filter process: {}", filter_invocation,)
|
||||
.into(),
|
||||
),
|
||||
source: None,
|
||||
body: err.to_string().into(),
|
||||
kind: Some(NotificationType::Error(melib::ErrorKind::External)),
|
||||
});
|
||||
String::from_utf8_lossy(&bytes).to_string()
|
||||
}
|
||||
Ok(mut html_filter) => {
|
||||
|
@ -108,11 +109,12 @@ impl HtmlView {
|
|||
|
||||
display_text
|
||||
} else {
|
||||
context.replies.push_back(UIEvent::Notification(
|
||||
Some("Failed to find any application to use as html filter".to_string()),
|
||||
String::new(),
|
||||
Some(NotificationType::Error(melib::error::ErrorKind::None)),
|
||||
));
|
||||
context.replies.push_back(UIEvent::Notification {
|
||||
title: Some("Failed to find any application to use as html filter".into()),
|
||||
source: None,
|
||||
body: "".into(),
|
||||
kind: Some(NotificationType::Error(melib::error::ErrorKind::None)),
|
||||
});
|
||||
String::from_utf8_lossy(&bytes).to_string()
|
||||
};
|
||||
if body.count_attachments() > 1 {
|
||||
|
@ -173,31 +175,36 @@ impl Component for HtmlView {
|
|||
command
|
||||
};
|
||||
if let Some(command) = command {
|
||||
let p = create_temp_file(&self.bytes, None, None, Some("html"), true);
|
||||
context
|
||||
.replies
|
||||
.push_back(UIEvent::StatusEvent(StatusEvent::UpdateSubStatus(
|
||||
command.to_string(),
|
||||
)));
|
||||
let exec_cmd =
|
||||
super::desktop_exec_to_command(&command, p.path.display().to_string(), false);
|
||||
match File::create_temp_file(&self.bytes, None, None, Some("html"), true).and_then(
|
||||
|p| {
|
||||
let exec_cmd = super::desktop_exec_to_command(
|
||||
&command,
|
||||
p.path().display().to_string(),
|
||||
false,
|
||||
);
|
||||
|
||||
match Command::new("sh")
|
||||
.args(["-c", &exec_cmd])
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()
|
||||
{
|
||||
Ok(child) => {
|
||||
Ok((
|
||||
p,
|
||||
Command::new("sh")
|
||||
.args(["-c", &exec_cmd])
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()?,
|
||||
))
|
||||
},
|
||||
) {
|
||||
Ok((p, child)) => {
|
||||
context.temp_files.push(p);
|
||||
context.children.push(child);
|
||||
}
|
||||
Err(err) => {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
StatusEvent::DisplayMessage(format!(
|
||||
"Failed to start `{}`: {}",
|
||||
&exec_cmd, err
|
||||
)),
|
||||
StatusEvent::DisplayMessage(format!("Failed to start {err}",)),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use melib::{text_processing::Truncate, Envelope, Error, Mail, Result};
|
||||
use melib::{text::Truncate, Envelope, Error, Mail, Result};
|
||||
|
||||
use super::{EnvelopeView, MailView, ViewSettings};
|
||||
use crate::{jobs::JoinHandle, mailbox_settings, Component, Context, ShortcutMaps, UIEvent};
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum PendingReplyAction {
|
||||
Reply,
|
||||
ReplyToAuthor,
|
||||
|
@ -149,7 +149,7 @@ impl MailViewState {
|
|||
}),
|
||||
context.main_loop_handler.clone(),
|
||||
));
|
||||
self_.state = MailViewState::Loaded {
|
||||
self_.state = Self::Loaded {
|
||||
env,
|
||||
bytes,
|
||||
env_view,
|
||||
|
@ -192,7 +192,7 @@ impl MailViewState {
|
|||
|
||||
impl Default for MailViewState {
|
||||
fn default() -> Self {
|
||||
MailViewState::Init {
|
||||
Self::Init {
|
||||
pending_action: None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
//
|
||||
// meli
|
||||
//
|
||||
// Copyright 2023 Manos Pitsidianakis
|
||||
//
|
||||
// This file is part of meli.
|
||||
//
|
||||
// meli is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// meli is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//use super::ViewFilter;
|
||||
//use crate::melib::{Attachment, AttachmentBuilder};
|
||||
//use crate::Context;
|
||||
|
||||
#[test]
|
||||
fn test_view_filter_text_plain() {
|
||||
println!("[ref:TODO]");
|
||||
//let bytes = b"";
|
||||
//let tempdir = tempfile::tempdir().unwrap();
|
||||
//let mut ctx = Context::new_mock(&tempdir);
|
||||
//let att: Attachment = AttachmentBuilder::new(bytes).build();
|
||||
//let value = ViewFilter::new_attachment(&att, &mut ctx).unwrap();
|
||||
//assert_eq!(&value.content_type.to_string(), "text/plain");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_view_filter_text_html() {
|
||||
println!("[ref:TODO]");
|
||||
//let bytes = b"";
|
||||
//let tempdir = tempfile::tempdir().unwrap();
|
||||
//let mut ctx = Context::new_mock(&tempdir);
|
||||
//let att: Attachment = AttachmentBuilder::new(bytes).build();
|
||||
//let value = ViewFilter::new_attachment(&att, &mut ctx).unwrap();
|
||||
//assert_eq!(&value.content_type.to_string(), "text/html");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_view_filter_multipart_alternative_plain_and_html() {
|
||||
println!("[ref:TODO]");
|
||||
//let bytes = b"";
|
||||
//let tempdir = tempfile::tempdir().unwrap();
|
||||
//let mut ctx = Context::new_mock(&tempdir);
|
||||
//let att: Attachment = AttachmentBuilder::new(bytes).build();
|
||||
//let value = ViewFilter::new_attachment(&att, &mut ctx).unwrap();
|
||||
//assert_eq!(&value.content_type.to_string(), "text/plain");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_view_filter_multipart_alternative_empty_plain_and_html() {
|
||||
println!("[ref:TODO]");
|
||||
//let bytes = b"";
|
||||
//let tempdir = tempfile::tempdir().unwrap();
|
||||
//let mut ctx = Context::new_mock(&tempdir);
|
||||
//let att: Attachment = AttachmentBuilder::new(bytes).build();
|
||||
//let value = ViewFilter::new_attachment(&att, &mut ctx).unwrap();
|
||||
//assert_eq!(&value.content_type.to_string(), "text/html");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_view_filter_multipart_digest() {
|
||||
println!("[ref:TODO]");
|
||||
//let bytes = b"";
|
||||
//let tempdir = tempfile::tempdir().unwrap();
|
||||
//let mut ctx = Context::new_mock(&tempdir);
|
||||
//let att: Attachment = AttachmentBuilder::new(bytes).build();
|
||||
//let value = ViewFilter::new_attachment(&att, &mut ctx).unwrap();
|
||||
//assert_eq!(&value.content_type.to_string(), "multipart/digest");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_view_filter_multipart_mixed() {
|
||||
println!("[ref:TODO]");
|
||||
//let bytes = b"";
|
||||
//let tempdir = tempfile::tempdir().unwrap();
|
||||
//let mut ctx = Context::new_mock(&tempdir);
|
||||
//let att: Attachment = AttachmentBuilder::new(bytes).build();
|
||||
//let value = ViewFilter::new_attachment(&att, &mut ctx).unwrap();
|
||||
//assert_eq!(&value.content_type.to_string(), "multipart/mixed");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_view_filter_multipart_related() {
|
||||
println!("[ref:TODO]");
|
||||
//let bytes = b"";
|
||||
//let tempdir = tempfile::tempdir().unwrap();
|
||||
//let mut ctx = Context::new_mock(&tempdir);
|
||||
//let att: Attachment = AttachmentBuilder::new(bytes).build();
|
||||
//let value = ViewFilter::new_attachment(&att, &mut ctx).unwrap();
|
||||
//assert_eq!(&value.content_type.to_string(), "text/related");
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -19,7 +19,12 @@
|
|||
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use melib::{attachment_types::Charset, pgp::DecryptionMetadata, Attachment, Error, Result};
|
||||
use std::fmt::Write as IoWrite;
|
||||
|
||||
use melib::{
|
||||
attachment_types::Charset, conf::ActionFlag, error::*, pgp::DecryptionMetadata, Attachment,
|
||||
Result,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
conf::shortcuts::EnvelopeViewShortcuts,
|
||||
|
@ -27,7 +32,7 @@ use crate::{
|
|||
ShortcutMap, ThemeAttribute, UIDialog,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ViewSettings {
|
||||
pub pager_filter: Option<String>,
|
||||
pub html_filter: Option<String>,
|
||||
|
@ -41,8 +46,8 @@ pub struct ViewSettings {
|
|||
pub sticky_headers: bool,
|
||||
pub show_date_in_my_timezone: bool,
|
||||
pub show_extra_headers: Vec<String>,
|
||||
pub auto_verify_signatures: bool,
|
||||
pub auto_decrypt: bool,
|
||||
pub auto_verify_signatures: ActionFlag,
|
||||
pub auto_decrypt: ActionFlag,
|
||||
}
|
||||
|
||||
impl Default for ViewSettings {
|
||||
|
@ -59,23 +64,24 @@ impl Default for ViewSettings {
|
|||
sticky_headers: false,
|
||||
show_date_in_my_timezone: false,
|
||||
show_extra_headers: vec![],
|
||||
auto_verify_signatures: true,
|
||||
auto_decrypt: true,
|
||||
auto_verify_signatures: ActionFlag::InternalVal(true),
|
||||
auto_decrypt: ActionFlag::InternalVal(true),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum LinkKind {
|
||||
Url,
|
||||
Email,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Link {
|
||||
pub start: usize,
|
||||
pub end: usize,
|
||||
pub kind: self::LinkKind,
|
||||
pub value: String,
|
||||
pub kind: LinkKind,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
|
@ -95,37 +101,104 @@ impl From<&ForceCharset> for Option<Charset> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum Source {
|
||||
Decoded,
|
||||
Raw,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug, Default)]
|
||||
pub enum ViewMode {
|
||||
#[default]
|
||||
Normal,
|
||||
Url,
|
||||
Attachment(usize),
|
||||
Source(Source),
|
||||
Subview,
|
||||
bitflags::bitflags! {
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct ViewOptions: u8 {
|
||||
const DEFAULT = 0;
|
||||
const URL = 1;
|
||||
const SOURCE = Self::URL.bits() << 1;
|
||||
const SOURCE_RAW = Self::SOURCE.bits() << 1;
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! is_variant {
|
||||
($n:ident, $($var:tt)+) => {
|
||||
#[inline]
|
||||
pub fn $n(&self) -> bool {
|
||||
matches!(self, Self::$($var)*)
|
||||
impl Default for ViewOptions {
|
||||
fn default() -> Self {
|
||||
Self::DEFAULT
|
||||
}
|
||||
}
|
||||
|
||||
impl ViewOptions {
|
||||
pub fn convert(
|
||||
&self,
|
||||
links: &mut Vec<Link>,
|
||||
attachment: &melib::Attachment,
|
||||
text: &str,
|
||||
) -> String {
|
||||
let mut text = if self.contains(Self::SOURCE) {
|
||||
if self.contains(Self::SOURCE_RAW) {
|
||||
String::from_utf8_lossy(attachment.raw()).into_owned()
|
||||
} else {
|
||||
/* Decode each header value */
|
||||
let mut ret = String::new();
|
||||
match melib::email::parser::headers::headers(attachment.raw()).map(|(_, v)| v) {
|
||||
Ok(headers) => {
|
||||
for (h, v) in headers {
|
||||
_ = match melib::email::parser::encodings::phrase(v, true) {
|
||||
Ok((_, v)) => ret.write_fmt(format_args!(
|
||||
"{h}: {}\n",
|
||||
String::from_utf8_lossy(&v)
|
||||
)),
|
||||
Err(err) => ret.write_fmt(format_args!("{h}: {err}\n")),
|
||||
};
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
_ = write!(&mut ret, "{err}");
|
||||
}
|
||||
}
|
||||
if !ret.ends_with("\n\n") {
|
||||
ret.push_str("\n\n");
|
||||
}
|
||||
ret.push_str(text);
|
||||
ret
|
||||
}
|
||||
} else {
|
||||
text.to_string()
|
||||
};
|
||||
|
||||
while text.ends_with("\n\n") {
|
||||
text.pop();
|
||||
text.pop();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
impl ViewMode {
|
||||
is_variant! { is_normal, Normal }
|
||||
is_variant! { is_url, Url }
|
||||
is_variant! { is_attachment, Attachment(_) }
|
||||
is_variant! { is_source, Source(_) }
|
||||
is_variant! { is_subview, Subview }
|
||||
if self.contains(Self::URL) {
|
||||
if links.is_empty() {
|
||||
let finder = linkify::LinkFinder::new();
|
||||
*links = finder
|
||||
.links(&text)
|
||||
.filter_map(|l| {
|
||||
Some(Link {
|
||||
start: l.start(),
|
||||
end: l.end(),
|
||||
value: l.as_str().to_string(),
|
||||
kind: match l.kind() {
|
||||
linkify::LinkKind::Url => LinkKind::Url,
|
||||
linkify::LinkKind::Email => LinkKind::Email,
|
||||
_ => return None,
|
||||
},
|
||||
})
|
||||
})
|
||||
.collect::<Vec<Link>>();
|
||||
}
|
||||
for (lidx, l) in links.iter().enumerate().rev() {
|
||||
let mut start = l.start;
|
||||
while start < text.len() && !text.is_char_boundary(start) {
|
||||
start += 1;
|
||||
}
|
||||
if start < text.len() {
|
||||
text.insert_str(start, &format!("[{}]", lidx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
text
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
use std::cmp;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use melib::backends::AccountHash;
|
||||
use melib::{backends::AccountHash, SortOrder};
|
||||
|
||||
use super::*;
|
||||
use crate::{accounts::MailboxEntry, melib::text_processing::TextProcessing};
|
||||
use crate::{accounts::MailboxEntry, melib::text::TextProcessing};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
enum MailboxAction {
|
||||
Rename,
|
||||
Move,
|
||||
|
@ -41,6 +41,23 @@ enum ViewMode {
|
|||
Action(UIDialog<MailboxAction>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
#[repr(u8)]
|
||||
enum Column {
|
||||
_0 = 0,
|
||||
_1,
|
||||
_2,
|
||||
_3,
|
||||
}
|
||||
|
||||
const fn _assert_len() {
|
||||
if MailboxManager::HEADERS.len() != Column::_3 as usize + 1 {
|
||||
panic!("MailboxManager::HEADERS length changed, please update Column enum accordingly.");
|
||||
}
|
||||
}
|
||||
|
||||
const _: () = _assert_len();
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct MailboxManager {
|
||||
cursor_pos: usize,
|
||||
|
@ -48,7 +65,10 @@ pub struct MailboxManager {
|
|||
account_pos: usize,
|
||||
account_hash: AccountHash,
|
||||
length: usize,
|
||||
data_columns: DataColumns<5>,
|
||||
data_columns: DataColumns<4>,
|
||||
min_width: [usize; 4],
|
||||
sort_col: Column,
|
||||
sort_order: SortOrder,
|
||||
entries: IndexMap<MailboxHash, MailboxEntry>,
|
||||
mode: ViewMode,
|
||||
|
||||
|
@ -69,12 +89,14 @@ impl std::fmt::Display for MailboxManager {
|
|||
}
|
||||
|
||||
impl MailboxManager {
|
||||
const HEADERS: [&'static str; 4] = ["name", "path", "size", "subscribed"];
|
||||
|
||||
pub fn new(context: &Context, account_pos: usize) -> Self {
|
||||
let account_hash = context.accounts[account_pos].hash();
|
||||
let theme_default = crate::conf::value(context, "theme_default");
|
||||
let mut data_columns = DataColumns::default();
|
||||
data_columns.theme_config.set_single_theme(theme_default);
|
||||
MailboxManager {
|
||||
Self {
|
||||
cursor_pos: 0,
|
||||
new_cursor_pos: 0,
|
||||
account_hash,
|
||||
|
@ -83,6 +105,9 @@ impl MailboxManager {
|
|||
length: 0,
|
||||
account_pos,
|
||||
data_columns,
|
||||
sort_col: Column::_1,
|
||||
sort_order: SortOrder::Asc,
|
||||
min_width: [0; 4],
|
||||
theme_default,
|
||||
highlight_theme: crate::conf::value(context, "highlight"),
|
||||
initialized: false,
|
||||
|
@ -92,121 +117,160 @@ impl MailboxManager {
|
|||
}
|
||||
}
|
||||
|
||||
fn initialize(&mut self, context: &mut Context) {
|
||||
fn initialize(&mut self, context: &Context) {
|
||||
let account = &context.accounts[self.account_pos];
|
||||
self.length = account.mailbox_entries.len();
|
||||
self.entries = account.mailbox_entries.clone();
|
||||
self.entries
|
||||
.sort_by(|_, a, _, b| a.ref_mailbox.path().cmp(b.ref_mailbox.path()));
|
||||
|
||||
self.set_dirty(true);
|
||||
let mut min_width = (
|
||||
"name".len(),
|
||||
"path".len(),
|
||||
"size".len(),
|
||||
"subscribed".len(),
|
||||
0,
|
||||
0,
|
||||
);
|
||||
|
||||
for c in self.entries.values() {
|
||||
/* title */
|
||||
min_width.0 = cmp::max(min_width.0, c.name().split_graphemes().len());
|
||||
/* path */
|
||||
min_width.1 = cmp::max(min_width.1, c.ref_mailbox.path().len());
|
||||
let mut entries = account.mailbox_entries.clone();
|
||||
entries.sort_by(|_, a, _, b| match (self.sort_col, self.sort_order) {
|
||||
(Column::_0, SortOrder::Asc) => a.ref_mailbox.name().cmp(b.ref_mailbox.name()),
|
||||
(Column::_0, SortOrder::Desc) => b.ref_mailbox.name().cmp(a.ref_mailbox.name()),
|
||||
(Column::_1, SortOrder::Asc) => a.ref_mailbox.path().cmp(b.ref_mailbox.path()),
|
||||
(Column::_1, SortOrder::Desc) => b.ref_mailbox.path().cmp(a.ref_mailbox.path()),
|
||||
(Column::_2, SortOrder::Asc) => {
|
||||
let (_, a) = a.ref_mailbox.count().ok().unwrap_or((0, 0));
|
||||
let (_, b) = b.ref_mailbox.count().ok().unwrap_or((0, 0));
|
||||
a.cmp(&b)
|
||||
}
|
||||
(Column::_2, SortOrder::Desc) => {
|
||||
let (_, a) = a.ref_mailbox.count().ok().unwrap_or((0, 0));
|
||||
let (_, b) = b.ref_mailbox.count().ok().unwrap_or((0, 0));
|
||||
b.cmp(&a)
|
||||
}
|
||||
(Column::_3, SortOrder::Asc)
|
||||
if a.ref_mailbox.is_subscribed() && b.ref_mailbox.is_subscribed() =>
|
||||
{
|
||||
std::cmp::Ordering::Equal
|
||||
}
|
||||
(Column::_3, SortOrder::Asc) if a.ref_mailbox.is_subscribed() => {
|
||||
std::cmp::Ordering::Greater
|
||||
}
|
||||
(Column::_3, SortOrder::Desc) if a.ref_mailbox.is_subscribed() => {
|
||||
std::cmp::Ordering::Less
|
||||
}
|
||||
(Column::_3, SortOrder::Asc) => std::cmp::Ordering::Less,
|
||||
(Column::_3, SortOrder::Desc) => std::cmp::Ordering::Greater,
|
||||
});
|
||||
self.entries = entries;
|
||||
macro_rules! hdr {
|
||||
($idx:literal) => {{
|
||||
Self::HEADERS[$idx].len() + if self.sort_col as u8 == $idx { 1 } else { 0 }
|
||||
}};
|
||||
}
|
||||
|
||||
/* name column */
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(min_width.0, self.length, None, context);
|
||||
/* path column */
|
||||
self.data_columns.columns[1] =
|
||||
CellBuffer::new_with_context(min_width.1, self.length, None, context);
|
||||
/* size column */
|
||||
self.data_columns.columns[2] =
|
||||
CellBuffer::new_with_context(min_width.2, self.length, None, context);
|
||||
/* subscribed column */
|
||||
self.data_columns.columns[3] =
|
||||
CellBuffer::new_with_context(min_width.3, self.length, None, context);
|
||||
self.set_dirty(true);
|
||||
let mut min_width = [hdr!(0), hdr!(1), hdr!(2), hdr!(3)];
|
||||
|
||||
for c in self.entries.values() {
|
||||
// title
|
||||
min_width[0] = cmp::max(min_width[0], c.name().split_graphemes().len());
|
||||
// path
|
||||
min_width[1] = cmp::max(min_width[1], c.ref_mailbox.path().len());
|
||||
}
|
||||
|
||||
// name column
|
||||
_ = self.data_columns.columns[0].resize_with_context(min_width[0], self.length, context);
|
||||
self.data_columns.columns[0].grid_mut().clear(None);
|
||||
// path column
|
||||
_ = self.data_columns.columns[1].resize_with_context(min_width[1], self.length, context);
|
||||
self.data_columns.columns[1].grid_mut().clear(None);
|
||||
// size column
|
||||
_ = self.data_columns.columns[2].resize_with_context(min_width[2], self.length, context);
|
||||
self.data_columns.columns[2].grid_mut().clear(None);
|
||||
// subscribed column
|
||||
_ = self.data_columns.columns[3].resize_with_context(min_width[3], self.length, context);
|
||||
self.data_columns.columns[3].grid_mut().clear(None);
|
||||
|
||||
for (idx, e) in self.entries.values().enumerate() {
|
||||
write_string_to_grid(
|
||||
e.name(),
|
||||
&mut self.data_columns.columns[0],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (min_width.0, idx)),
|
||||
None,
|
||||
);
|
||||
{
|
||||
let area = self.data_columns.columns[0].area().nth_row(idx);
|
||||
self.data_columns.columns[0].grid_mut().write_string(
|
||||
e.name(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
write_string_to_grid(
|
||||
e.ref_mailbox.path(),
|
||||
&mut self.data_columns.columns[1],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (min_width.1, idx)),
|
||||
None,
|
||||
);
|
||||
{
|
||||
let area = self.data_columns.columns[1].area().nth_row(idx);
|
||||
self.data_columns.columns[1].grid_mut().write_string(
|
||||
e.ref_mailbox.path(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
let (_unseen, total) = e.ref_mailbox.count().ok().unwrap_or((0, 0));
|
||||
write_string_to_grid(
|
||||
&total.to_string(),
|
||||
&mut self.data_columns.columns[2],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (min_width.2, idx)),
|
||||
None,
|
||||
);
|
||||
{
|
||||
let area = self.data_columns.columns[2].area().nth_row(idx);
|
||||
let (_unseen, total) = e.ref_mailbox.count().ok().unwrap_or((0, 0));
|
||||
self.data_columns.columns[2].grid_mut().write_string(
|
||||
&total.to_string(),
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
write_string_to_grid(
|
||||
if e.ref_mailbox.is_subscribed() {
|
||||
"yes"
|
||||
} else {
|
||||
"no"
|
||||
},
|
||||
&mut self.data_columns.columns[3],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, idx), (min_width.3, idx)),
|
||||
None,
|
||||
);
|
||||
{
|
||||
let area = self.data_columns.columns[3].area().nth_row(idx);
|
||||
self.data_columns.columns[3].grid_mut().write_string(
|
||||
if e.ref_mailbox.is_subscribed() {
|
||||
"yes"
|
||||
} else {
|
||||
"no"
|
||||
},
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if self.length == 0 {
|
||||
let message = "No mailboxes.".to_string();
|
||||
self.data_columns.columns[0] =
|
||||
CellBuffer::new_with_context(message.len(), self.length, None, context);
|
||||
write_string_to_grid(
|
||||
&message,
|
||||
&mut self.data_columns.columns[0],
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
((0, 0), (message.len() - 1, 0)),
|
||||
None,
|
||||
);
|
||||
if self.data_columns.columns[0].resize_with_context(message.len(), self.length, context)
|
||||
{
|
||||
let area = self.data_columns.columns[0].area();
|
||||
self.data_columns.columns[0].grid_mut().write_string(
|
||||
&message,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area,
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
self.min_width = min_width;
|
||||
}
|
||||
|
||||
fn draw_list(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
let (upper_left, bottom_right) = area;
|
||||
let rows = area.height();
|
||||
if rows < 2 {
|
||||
return;
|
||||
}
|
||||
|
||||
if self.length == 0 {
|
||||
clear_area(grid, area, self.theme_default);
|
||||
copy_area(
|
||||
grid,
|
||||
&self.data_columns.columns[0],
|
||||
grid.clear_area(area, self.theme_default);
|
||||
|
||||
grid.copy_area(
|
||||
self.data_columns.columns[0].grid(),
|
||||
area,
|
||||
((0, 0), pos_dec(self.data_columns.columns[0].size(), (1, 1))),
|
||||
self.data_columns.columns[0].area(),
|
||||
);
|
||||
context.dirty_areas.push_back(area);
|
||||
return;
|
||||
}
|
||||
let rows = get_y(bottom_right) - get_y(upper_left) + 1;
|
||||
|
||||
if let Some(mvm) = self.movement.take() {
|
||||
match mvm {
|
||||
|
@ -233,7 +297,20 @@ impl MailboxManager {
|
|||
self.new_cursor_pos = (self.length / rows) * rows;
|
||||
}
|
||||
}
|
||||
PageMovement::Right(_) | PageMovement::Left(_) => {}
|
||||
PageMovement::Right(amount) => {
|
||||
self.data_columns.x_offset += amount;
|
||||
self.data_columns.x_offset = self.data_columns.x_offset.min(
|
||||
self.data_columns
|
||||
.widths
|
||||
.iter()
|
||||
.map(|w| w + 2)
|
||||
.sum::<usize>()
|
||||
.saturating_sub(2),
|
||||
);
|
||||
}
|
||||
PageMovement::Left(amount) => {
|
||||
self.data_columns.x_offset = self.data_columns.x_offset.saturating_sub(amount);
|
||||
}
|
||||
PageMovement::Home => {
|
||||
self.new_cursor_pos = 0;
|
||||
}
|
||||
|
@ -269,8 +346,8 @@ impl MailboxManager {
|
|||
)));
|
||||
}
|
||||
|
||||
/* If cursor position has changed, remove the highlight from the previous
|
||||
* position and apply it in the new one. */
|
||||
// If cursor position has changed, remove the highlight from the previous
|
||||
// position and apply it in the new one.
|
||||
if self.cursor_pos != self.new_cursor_pos && prev_page_no == page_no {
|
||||
let old_cursor_pos = self.cursor_pos;
|
||||
self.cursor_pos = self.new_cursor_pos;
|
||||
|
@ -278,7 +355,7 @@ impl MailboxManager {
|
|||
if idx >= self.length {
|
||||
continue; //bounds check
|
||||
}
|
||||
let new_area = nth_row_area(area, idx % rows);
|
||||
let new_area = area.nth_row(idx % rows);
|
||||
self.data_columns
|
||||
.draw(grid, idx, self.cursor_pos, grid.bounds_iter(new_area));
|
||||
let row_attr = if highlight {
|
||||
|
@ -286,7 +363,7 @@ impl MailboxManager {
|
|||
} else {
|
||||
self.theme_default
|
||||
};
|
||||
change_theme(grid, new_area, row_attr);
|
||||
grid.change_theme(new_area, row_attr);
|
||||
context.dirty_areas.push_back(new_area);
|
||||
}
|
||||
return;
|
||||
|
@ -297,32 +374,21 @@ impl MailboxManager {
|
|||
self.new_cursor_pos = self.length - 1;
|
||||
self.cursor_pos = self.new_cursor_pos;
|
||||
}
|
||||
/* Page_no has changed, so draw new page */
|
||||
// Page_no has changed, so draw new page
|
||||
_ = self
|
||||
.data_columns
|
||||
.recalc_widths((width!(area), height!(area)), top_idx);
|
||||
clear_area(grid, area, self.theme_default);
|
||||
/* copy table columns */
|
||||
.recalc_widths((area.width(), area.height()), top_idx);
|
||||
grid.clear_area(area, self.theme_default);
|
||||
// copy table columns
|
||||
self.data_columns
|
||||
.draw(grid, top_idx, self.cursor_pos, grid.bounds_iter(area));
|
||||
|
||||
/* highlight cursor */
|
||||
change_theme(
|
||||
grid,
|
||||
nth_row_area(area, self.cursor_pos % rows),
|
||||
self.highlight_theme,
|
||||
);
|
||||
// highlight cursor
|
||||
grid.change_theme(area.nth_row(self.cursor_pos % rows), self.highlight_theme);
|
||||
|
||||
/* clear gap if available height is more than count of entries */
|
||||
// clear gap if available height is more than count of entries
|
||||
if top_idx + rows > self.length {
|
||||
clear_area(
|
||||
grid,
|
||||
(
|
||||
pos_inc(upper_left, (0, self.length - top_idx)),
|
||||
bottom_right,
|
||||
),
|
||||
self.theme_default,
|
||||
);
|
||||
grid.change_theme(area.skip_rows(self.length - top_idx), self.theme_default);
|
||||
}
|
||||
context.dirty_areas.push_back(area);
|
||||
}
|
||||
|
@ -336,7 +402,42 @@ impl Component for MailboxManager {
|
|||
if !self.initialized {
|
||||
self.initialize(context);
|
||||
}
|
||||
|
||||
if self.dirty {
|
||||
let area = area.nth_row(0);
|
||||
// Draw column headers.
|
||||
grid.clear_area(area, self.theme_default);
|
||||
let mut x_offset = 0;
|
||||
for (i, (h, w)) in Self::HEADERS.iter().zip(self.min_width).enumerate() {
|
||||
grid.write_string(
|
||||
h,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs | Attr::BOLD,
|
||||
area.skip_cols(x_offset),
|
||||
None,
|
||||
);
|
||||
if self.sort_col as usize == i {
|
||||
use SortOrder::*;
|
||||
let arrow = match (grid.ascii_drawing, self.sort_order) {
|
||||
(true, Asc) => DataColumns::<4>::ARROW_UP_ASCII,
|
||||
(true, Desc) => DataColumns::<4>::ARROW_DOWN_ASCII,
|
||||
(false, Asc) => DataColumns::<4>::ARROW_UP,
|
||||
(false, Desc) => DataColumns::<4>::ARROW_DOWN,
|
||||
};
|
||||
grid.write_string(
|
||||
arrow,
|
||||
self.theme_default.fg,
|
||||
self.theme_default.bg,
|
||||
self.theme_default.attrs,
|
||||
area.skip_cols(x_offset + h.len()),
|
||||
None,
|
||||
);
|
||||
}
|
||||
x_offset += w + 2;
|
||||
}
|
||||
context.dirty_areas.push_back(area);
|
||||
}
|
||||
let area = area.skip_rows(1);
|
||||
self.draw_list(grid, area, context);
|
||||
if let ViewMode::Action(ref mut s) = self.mode {
|
||||
s.draw(grid, area, context);
|
||||
|
@ -383,11 +484,14 @@ impl Component for MailboxManager {
|
|||
.to_string(),
|
||||
))
|
||||
{
|
||||
context.replies.push_back(UIEvent::Notification(
|
||||
None,
|
||||
err.to_string(),
|
||||
Some(crate::types::NotificationType::Error(err.kind)),
|
||||
));
|
||||
context.replies.push_back(UIEvent::Notification {
|
||||
title: None,
|
||||
source: None,
|
||||
body: err.to_string().into(),
|
||||
kind: Some(crate::types::NotificationType::Error(
|
||||
err.kind,
|
||||
)),
|
||||
});
|
||||
}
|
||||
}
|
||||
MailboxAction::Unsubscribe => {
|
||||
|
@ -399,11 +503,14 @@ impl Component for MailboxManager {
|
|||
.to_string(),
|
||||
))
|
||||
{
|
||||
context.replies.push_back(UIEvent::Notification(
|
||||
None,
|
||||
err.to_string(),
|
||||
Some(crate::types::NotificationType::Error(err.kind)),
|
||||
));
|
||||
context.replies.push_back(UIEvent::Notification {
|
||||
title: None,
|
||||
source: None,
|
||||
body: err.to_string().into(),
|
||||
kind: Some(crate::types::NotificationType::Error(
|
||||
err.kind,
|
||||
)),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -424,7 +531,6 @@ impl Component for MailboxManager {
|
|||
self.initialize(context);
|
||||
|
||||
self.set_dirty(true);
|
||||
//self.menu_content.empty();
|
||||
context
|
||||
.replies
|
||||
.push_back(UIEvent::StatusEvent(StatusEvent::UpdateStatus(match msg {
|
||||
|
@ -432,6 +538,53 @@ impl Component for MailboxManager {
|
|||
None => self.status(context),
|
||||
})));
|
||||
}
|
||||
UIEvent::Action(Action::SortColumn(column, order)) => {
|
||||
let column = match *column {
|
||||
0 => Column::_0,
|
||||
1 => Column::_1,
|
||||
2 => Column::_2,
|
||||
3 => Column::_3,
|
||||
other => {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
StatusEvent::DisplayMessage(format!(
|
||||
"Invalid column index `{}`: there are {} columns.",
|
||||
other,
|
||||
Self::HEADERS.len()
|
||||
)),
|
||||
));
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
if (self.sort_col, self.sort_order) != (column, *order) {
|
||||
self.sort_col = column;
|
||||
self.sort_order = *order;
|
||||
self.initialized = false;
|
||||
self.set_dirty(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
UIEvent::Input(Key::Char(ref c)) if c.is_ascii_digit() => {
|
||||
let n = *c as u8 - b'0'; // safe cast because of is_ascii_digit() check;
|
||||
let column = match n {
|
||||
1 => Column::_0,
|
||||
2 => Column::_1,
|
||||
3 => Column::_2,
|
||||
4 => Column::_3,
|
||||
_ => {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
if self.sort_col == column {
|
||||
self.sort_order = !self.sort_order;
|
||||
} else {
|
||||
self.sort_col = column;
|
||||
self.sort_order = SortOrder::default();
|
||||
}
|
||||
self.initialized = false;
|
||||
self.set_dirty(true);
|
||||
return true;
|
||||
}
|
||||
UIEvent::Input(ref key)
|
||||
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_up"]) =>
|
||||
{
|
||||
|
@ -546,7 +699,11 @@ impl Component for MailboxManager {
|
|||
true
|
||||
}
|
||||
|
||||
fn status(&self, _context: &Context) -> String {
|
||||
format!("{} entries", self.entries.len())
|
||||
fn status(&self, context: &Context) -> String {
|
||||
format!(
|
||||
"{} {} entries",
|
||||
context.accounts[&self.account_hash].name(),
|
||||
self.entries.len()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,17 +24,16 @@
|
|||
//! Implements [RFC 1524 A User Agent Configuration Mechanism For Multimedia
|
||||
//! Mail Format Information](https://www.rfc-editor.org/rfc/inline-errata/rfc1524.html)
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
io::{Read, Write},
|
||||
path::PathBuf,
|
||||
process::{Command, Stdio},
|
||||
};
|
||||
|
||||
use melib::{email::Attachment, log, text_processing::GlobMatch, Error, Result};
|
||||
use melib::{email::Attachment, log, text::GlobMatch, Error, Result};
|
||||
|
||||
use crate::{
|
||||
state::Context,
|
||||
types::{create_temp_file, ForkType, UIEvent},
|
||||
types::{File, ForkType, UIEvent},
|
||||
};
|
||||
|
||||
pub struct MailcapEntry {
|
||||
|
@ -77,7 +76,6 @@ impl MailcapEntry {
|
|||
}
|
||||
}
|
||||
|
||||
let mut hash_map = HashMap::new();
|
||||
let mut content = String::new();
|
||||
|
||||
std::fs::File::open(mailcap_path.as_path())?.read_to_string(&mut content)?;
|
||||
|
@ -111,13 +109,12 @@ impl MailcapEntry {
|
|||
}
|
||||
}
|
||||
|
||||
result = Some(MailcapEntry {
|
||||
result = Some(Self {
|
||||
command: cmd.to_string(),
|
||||
copiousoutput,
|
||||
});
|
||||
break;
|
||||
}
|
||||
hash_map.insert(key.to_string(), cmd.to_string());
|
||||
} else {
|
||||
let mut parts_iter = l.split(';');
|
||||
let key = parts_iter.next().unwrap();
|
||||
|
@ -134,25 +131,23 @@ impl MailcapEntry {
|
|||
}
|
||||
}
|
||||
|
||||
result = Some(MailcapEntry {
|
||||
result = Some(Self {
|
||||
command: cmd.to_string(),
|
||||
copiousoutput,
|
||||
});
|
||||
break;
|
||||
}
|
||||
hash_map.insert(key.to_string(), cmd.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
match result {
|
||||
None => Err(Error::new("Not found")),
|
||||
Some(MailcapEntry {
|
||||
Some(Self {
|
||||
command,
|
||||
copiousoutput,
|
||||
}) => {
|
||||
let parts = split_command!(command);
|
||||
let (cmd, args) = (parts[0], &parts[1..]);
|
||||
let mut f = None;
|
||||
let mut needs_stdin = true;
|
||||
let params = a.parameters();
|
||||
/* [ref:TODO]: See mailcap(5)
|
||||
|
@ -165,31 +160,33 @@ impl MailcapEntry {
|
|||
.map(|arg| match *arg {
|
||||
"%s" => {
|
||||
needs_stdin = false;
|
||||
let _f = create_temp_file(
|
||||
let _f = File::create_temp_file(
|
||||
&a.decode(Default::default()),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
true,
|
||||
);
|
||||
)?;
|
||||
let p = _f.path().display().to_string();
|
||||
f = Some(_f);
|
||||
p
|
||||
Ok(p)
|
||||
}
|
||||
"%t" => a.content_type().to_string(),
|
||||
"%t" => Ok(a.content_type().to_string()),
|
||||
param if param.starts_with("%{") && param.ends_with('}') => {
|
||||
let param = ¶m["%{".len()..param.len() - 1];
|
||||
if let Some(v) = params.iter().find(|(k, _)| *k == param.as_bytes()) {
|
||||
String::from_utf8_lossy(v.1).into()
|
||||
} else if param == "charset" {
|
||||
String::from("utf-8")
|
||||
} else {
|
||||
String::new()
|
||||
}
|
||||
Ok(
|
||||
if let Some(v) = params.iter().find(|(k, _)| *k == param.as_bytes())
|
||||
{
|
||||
String::from_utf8_lossy(v.1).into()
|
||||
} else if param == "charset" {
|
||||
String::from("utf-8")
|
||||
} else {
|
||||
String::new()
|
||||
},
|
||||
)
|
||||
}
|
||||
a => a.to_string(),
|
||||
a => Ok(a.to_string()),
|
||||
})
|
||||
.collect::<Vec<String>>();
|
||||
.collect::<Result<Vec<String>>>()?;
|
||||
let cmd_string = format!("{} {}", cmd, args.join(" "));
|
||||
log::trace!("Executing: sh -c \"{}\"", cmd_string.replace('"', "\\\""));
|
||||
if copiousoutput {
|
||||
|
|
|
@ -101,6 +101,16 @@ fn run_app(opt: Opt) -> Result<()> {
|
|||
Some(SubCommand::EditConfig) => {
|
||||
return subcommands::edit_config();
|
||||
}
|
||||
Some(SubCommand::PrintConfigPath) => {
|
||||
let config_path = crate::conf::get_config_file()?;
|
||||
println!("{}", config_path.display());
|
||||
return Ok(());
|
||||
}
|
||||
#[cfg(not(feature = "cli-docs"))]
|
||||
Some(SubCommand::Man(ManOpt {})) => {
|
||||
return Err(Error::new("error: this version of meli was not build with embedded documentation (cargo feature `cli-docs`). You might have it installed as manpages (eg `man meli`), otherwise check https://meli-email.org"));
|
||||
}
|
||||
#[cfg(feature = "cli-docs")]
|
||||
Some(SubCommand::Man(ManOpt { page, no_raw })) => {
|
||||
return subcommands::man(page, false).and_then(|s| subcommands::pager(s, no_raw));
|
||||
}
|
||||
|
@ -117,7 +127,7 @@ fn run_app(opt: Opt) -> Result<()> {
|
|||
return Ok(());
|
||||
}
|
||||
Some(SubCommand::View { .. }) => {}
|
||||
Some(SubCommand::PrintUsedPaths) => {
|
||||
Some(SubCommand::PrintAppDirectories) => {
|
||||
println!(
|
||||
"{}",
|
||||
xdg::BaseDirectories::with_prefix("meli")
|
||||
|
@ -133,6 +143,13 @@ fn run_app(opt: Opt) -> Result<()> {
|
|||
println!("{}", temp_dir.display());
|
||||
return Ok(());
|
||||
}
|
||||
#[cfg(not(feature = "cli-docs"))]
|
||||
Some(SubCommand::InstallMan {
|
||||
destination_path: _,
|
||||
}) => {
|
||||
return Err(Error::new("error: this version of meli was not build with embedded documentation (cargo feature `cli-docs`). You might have it installed as manpages (eg `man meli`), otherwise check https://meli-email.org"));
|
||||
}
|
||||
#[cfg(feature = "cli-docs")]
|
||||
Some(SubCommand::InstallMan { destination_path }) => {
|
||||
match args::manpages::ManPages::install(destination_path) {
|
||||
Ok(p) => println!("Installed at {}.", p.display()),
|
||||
|
@ -140,6 +157,11 @@ fn run_app(opt: Opt) -> Result<()> {
|
|||
}
|
||||
return Ok(());
|
||||
}
|
||||
Some(SubCommand::PrintLogPath) => {
|
||||
let settings = crate::conf::Settings::new()?;
|
||||
println!("{}", settings._logger.log_dest().display());
|
||||
return Ok(());
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
|
||||
|
@ -151,7 +173,7 @@ fn run_app(opt: Opt) -> Result<()> {
|
|||
let signals = &[
|
||||
/* Catch SIGWINCH to handle terminal resizing */
|
||||
signal_hook::consts::SIGWINCH,
|
||||
/* Catch SIGCHLD to handle embed applications status change */
|
||||
/* Catch SIGCHLD to handle embedded applications status change */
|
||||
signal_hook::consts::SIGCHLD,
|
||||
];
|
||||
|
||||
|
@ -217,7 +239,7 @@ fn run_app(opt: Opt) -> Result<()> {
|
|||
}
|
||||
}
|
||||
match r.unwrap() {
|
||||
ThreadEvent::Input((Key::Ctrl('z'), _)) if state.mode != UIMode::Embed => {
|
||||
ThreadEvent::Input((Key::Ctrl('z'), _)) if state.mode != UIMode::Embedded => {
|
||||
state.switch_to_main_screen();
|
||||
//_thread_handler.join().expect("Couldn't join on the associated thread");
|
||||
let self_pid = nix::unistd::Pid::this();
|
||||
|
@ -233,8 +255,8 @@ fn run_app(opt: Opt) -> Result<()> {
|
|||
state.update_size();
|
||||
state.render();
|
||||
state.redraw();
|
||||
if state.mode == UIMode::Embed {
|
||||
state.rcv_event(UIEvent::EmbedInput(raw_input));
|
||||
if state.mode == UIMode::Embedded {
|
||||
state.rcv_event(UIEvent::EmbeddedInput(raw_input));
|
||||
state.redraw();
|
||||
}
|
||||
},
|
||||
|
@ -286,8 +308,8 @@ fn run_app(opt: Opt) -> Result<()> {
|
|||
},
|
||||
}
|
||||
},
|
||||
UIMode::Embed => {
|
||||
state.rcv_event(UIEvent::EmbedInput((k,r)));
|
||||
UIMode::Embedded => {
|
||||
state.rcv_event(UIEvent::EmbeddedInput((k,r)));
|
||||
state.redraw();
|
||||
},
|
||||
UIMode::Fork => {
|
||||
|
@ -333,7 +355,7 @@ fn run_app(opt: Opt) -> Result<()> {
|
|||
}
|
||||
},
|
||||
signal_hook::consts::SIGCHLD => {
|
||||
state.rcv_event(UIEvent::EmbedInput((Key::Null, vec![0])));
|
||||
state.rcv_event(UIEvent::EmbeddedInput((Key::Null, vec![0])));
|
||||
state.redraw();
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ use std::process::{Command, Stdio};
|
|||
|
||||
#[cfg(all(target_os = "linux", feature = "dbus-notifications"))]
|
||||
pub use dbus::*;
|
||||
use melib::{utils::datetime, UnixTimestamp};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
@ -47,7 +49,7 @@ mod dbus {
|
|||
|
||||
impl DbusNotifications {
|
||||
pub fn new(context: &Context) -> Self {
|
||||
DbusNotifications {
|
||||
Self {
|
||||
rate_limit: RateLimit::new(
|
||||
1000,
|
||||
1000,
|
||||
|
@ -66,7 +68,13 @@ mod dbus {
|
|||
return false;
|
||||
}
|
||||
|
||||
if let UIEvent::Notification(ref title, ref body, ref kind) = event {
|
||||
if let UIEvent::Notification {
|
||||
ref title,
|
||||
source: _,
|
||||
ref body,
|
||||
ref kind,
|
||||
} = event
|
||||
{
|
||||
if !self.rate_limit.tick() {
|
||||
return false;
|
||||
}
|
||||
|
@ -75,7 +83,7 @@ mod dbus {
|
|||
let mut notification = notify_rust::Notification::new();
|
||||
notification
|
||||
.appname("meli")
|
||||
.summary(title.as_ref().map(String::as_str).unwrap_or("meli"))
|
||||
.summary(title.as_ref().map(<_>::as_ref).unwrap_or("meli"))
|
||||
.body(&escape_str(body));
|
||||
match *kind {
|
||||
Some(NotificationType::NewMail) => {
|
||||
|
@ -168,14 +176,14 @@ mod dbus {
|
|||
}
|
||||
|
||||
/// Passes notifications to a user defined shell command
|
||||
#[derive(Default, Debug)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct NotificationCommand {
|
||||
id: ComponentId,
|
||||
}
|
||||
|
||||
impl NotificationCommand {
|
||||
pub fn new() -> Self {
|
||||
NotificationCommand::default()
|
||||
Self::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +197,13 @@ impl Component for NotificationCommand {
|
|||
fn draw(&mut self, _grid: &mut CellBuffer, _area: Area, _context: &mut Context) {}
|
||||
|
||||
fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool {
|
||||
if let UIEvent::Notification(ref title, ref body, ref kind) = event {
|
||||
if let UIEvent::Notification {
|
||||
ref title,
|
||||
source: _,
|
||||
ref body,
|
||||
ref kind,
|
||||
} = event
|
||||
{
|
||||
if context.settings.notifications.enable {
|
||||
if *kind == Some(NotificationType::NewMail) {
|
||||
if let Some(ref path) = context.settings.notifications.xbiff_file_path {
|
||||
|
@ -199,24 +213,29 @@ impl Component for NotificationCommand {
|
|||
}
|
||||
}
|
||||
|
||||
let mut script = context.settings.notifications.script.as_ref();
|
||||
if *kind == Some(NotificationType::NewMail)
|
||||
let script = if *kind == Some(NotificationType::NewMail)
|
||||
&& context.settings.notifications.new_mail_script.is_some()
|
||||
{
|
||||
script = context.settings.notifications.new_mail_script.as_ref();
|
||||
}
|
||||
context.settings.notifications.new_mail_script.as_ref()
|
||||
} else {
|
||||
context.settings.notifications.script.as_ref()
|
||||
};
|
||||
|
||||
if let Some(ref bin) = script {
|
||||
match Command::new(bin)
|
||||
.arg(&kind.map(|k| k.to_string()).unwrap_or_default())
|
||||
.arg(title.as_ref().map(String::as_str).unwrap_or("meli"))
|
||||
.arg(body)
|
||||
.arg(title.as_ref().map(<_>::as_ref).unwrap_or("meli"))
|
||||
.arg(body.as_ref())
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()
|
||||
{
|
||||
Ok(child) => {
|
||||
context.children.push(child);
|
||||
context
|
||||
.children
|
||||
.entry(stringify!(NotificationCommand).into())
|
||||
.or_default()
|
||||
.push(child);
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!("Could not run notification script: {err}.");
|
||||
|
@ -231,7 +250,7 @@ impl Component for NotificationCommand {
|
|||
message = body.replace('"', "'"),
|
||||
title = title
|
||||
.as_ref()
|
||||
.map(String::as_str)
|
||||
.map(<_>::as_ref)
|
||||
.unwrap_or("meli")
|
||||
.replace('"', "'"),
|
||||
subtitle = kind
|
||||
|
@ -247,7 +266,11 @@ impl Component for NotificationCommand {
|
|||
.spawn()
|
||||
{
|
||||
Ok(child) => {
|
||||
context.children.push(child);
|
||||
context
|
||||
.children
|
||||
.entry(stringify!(NotificationCommand).into())
|
||||
.or_default()
|
||||
.push(child);
|
||||
return false;
|
||||
}
|
||||
Err(err) => {
|
||||
|
@ -294,3 +317,174 @@ fn update_xbiff(path: &str) -> Result<()> {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
/// On-screen-display messages.
|
||||
pub struct DisplayMessage {
|
||||
pub timestamp: UnixTimestamp,
|
||||
pub msg: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Show notifications on [`Screen`].
|
||||
pub struct DisplayMessageBox {
|
||||
messages: SmallVec<[DisplayMessage; 8]>,
|
||||
pub expiration_start: Option<UnixTimestamp>,
|
||||
pub active: bool,
|
||||
dirty: bool,
|
||||
pub initialised: bool,
|
||||
pub pos: usize,
|
||||
cached_area: Area,
|
||||
id: ComponentId,
|
||||
}
|
||||
|
||||
impl DisplayMessageBox {
|
||||
pub fn new(sc: &Screen<Tty>) -> Box<Self> {
|
||||
Box::new(Self {
|
||||
messages: SmallVec::new(),
|
||||
expiration_start: None,
|
||||
pos: 0,
|
||||
active: false,
|
||||
dirty: false,
|
||||
initialised: false,
|
||||
cached_area: sc.area().into_empty(),
|
||||
id: ComponentId::default(),
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn cached_area(&self) -> Area {
|
||||
self.cached_area
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Deref for DisplayMessageBox {
|
||||
type Target = SmallVec<[DisplayMessage; 8]>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.messages
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::DerefMut for DisplayMessageBox {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.messages
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for DisplayMessageBox {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "")
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for DisplayMessageBox {
|
||||
fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
if let Some(DisplayMessage {
|
||||
ref timestamp,
|
||||
ref msg,
|
||||
..
|
||||
}) = self.messages.get(self.pos)
|
||||
{
|
||||
let noto_colors = crate::conf::value(context, "status.notification");
|
||||
use crate::melib::text::{Reflow, TextProcessing};
|
||||
|
||||
let box_width = area.width() / 3;
|
||||
if box_width < 10 {
|
||||
self.set_dirty(false);
|
||||
return;
|
||||
}
|
||||
|
||||
let msg_lines = msg.split_lines_reflow(Reflow::All, Some(box_width));
|
||||
let width = msg_lines
|
||||
.iter()
|
||||
.map(|line| line.grapheme_len() + 4)
|
||||
.max()
|
||||
.unwrap_or(0);
|
||||
|
||||
if width == 0 {
|
||||
self.set_dirty(false);
|
||||
return;
|
||||
}
|
||||
|
||||
self.cached_area = area.place_inside(
|
||||
(width, area.height().min(msg_lines.len() + 4)),
|
||||
false,
|
||||
false,
|
||||
);
|
||||
let box_displ_area = create_box(grid, self.cached_area);
|
||||
for row in grid.bounds_iter(box_displ_area) {
|
||||
for c in row {
|
||||
grid[c]
|
||||
.set_ch(' ')
|
||||
.set_fg(noto_colors.fg)
|
||||
.set_bg(noto_colors.bg)
|
||||
.set_attrs(noto_colors.attrs);
|
||||
}
|
||||
}
|
||||
let mut lines_no = 0;
|
||||
for (idx, line) in msg_lines
|
||||
.into_iter()
|
||||
.chain(Some(String::new()))
|
||||
.chain(Some(datetime::timestamp_to_string(*timestamp, None, false)))
|
||||
.enumerate()
|
||||
{
|
||||
let (_, y) = grid.write_string(
|
||||
&line,
|
||||
noto_colors.fg,
|
||||
noto_colors.bg,
|
||||
noto_colors.attrs,
|
||||
box_displ_area.skip_rows(idx),
|
||||
Some(0),
|
||||
);
|
||||
lines_no += 1 + y;
|
||||
}
|
||||
|
||||
if self.messages.len() > 1 {
|
||||
grid.write_string(
|
||||
&if self.pos == 0 {
|
||||
format!(
|
||||
"Next: {}",
|
||||
context.settings.shortcuts.general.info_message_next
|
||||
)
|
||||
} else if self.pos + 1 == self.len() {
|
||||
format!(
|
||||
"Prev: {}",
|
||||
context.settings.shortcuts.general.info_message_previous
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"Prev: {} Next: {}",
|
||||
context.settings.shortcuts.general.info_message_previous,
|
||||
context.settings.shortcuts.general.info_message_next
|
||||
)
|
||||
},
|
||||
noto_colors.fg,
|
||||
noto_colors.bg,
|
||||
noto_colors.attrs,
|
||||
box_displ_area.skip_rows(lines_no),
|
||||
Some(0),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
self.cached_area = area.into_empty();
|
||||
}
|
||||
self.set_dirty(false);
|
||||
}
|
||||
|
||||
fn process_event(&mut self, _event: &mut UIEvent, _context: &mut Context) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_dirty(&self) -> bool {
|
||||
self.dirty
|
||||
}
|
||||
|
||||
fn set_dirty(&mut self, value: bool) {
|
||||
self.dirty = value;
|
||||
}
|
||||
|
||||
fn id(&self) -> ComponentId {
|
||||
self.id
|
||||
}
|
||||
}
|
||||
|
|
|
@ -250,7 +250,7 @@ impl PluginBackend {
|
|||
plugin,
|
||||
channel: Arc::new(Mutex::new(channel)),
|
||||
collection: Default::default(),
|
||||
is_online: Arc::new(Mutex::new((now, Err(Error::new("Unitialized"))))),
|
||||
is_online: Arc::new(Mutex::new((now, Err(Error::new("Uninitialized"))))),
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
@ -26,22 +26,23 @@ use std::{
|
|||
};
|
||||
|
||||
use melib::{
|
||||
backends::{MailBackend, ResultFuture},
|
||||
backends::MailBackend,
|
||||
email::{Envelope, EnvelopeHash},
|
||||
log,
|
||||
search::{
|
||||
escape_double_quote,
|
||||
Query::{self, *},
|
||||
},
|
||||
utils::sqlite3::{self as melib_sqlite3, rusqlite::params, DatabaseDescription},
|
||||
Error, Result, SortField, SortOrder,
|
||||
smol,
|
||||
utils::sqlite3::{rusqlite::params, DatabaseDescription},
|
||||
Error, Result, ResultIntoError, SortField, SortOrder,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::melib::ResultIntoError;
|
||||
|
||||
const DB: DatabaseDescription = DatabaseDescription {
|
||||
name: "index.db",
|
||||
identifier: None,
|
||||
application_prefix: "meli",
|
||||
init_script: Some(
|
||||
"CREATE TABLE IF NOT EXISTS envelopes (
|
||||
id INTEGER PRIMARY KEY,
|
||||
|
@ -113,10 +114,6 @@ END; ",
|
|||
version: 1,
|
||||
};
|
||||
|
||||
pub fn db_path() -> Result<PathBuf> {
|
||||
melib_sqlite3::db_path(DB.name)
|
||||
}
|
||||
|
||||
//#[inline(always)]
|
||||
//fn fts5_bareword(w: &str) -> Cow<str> {
|
||||
// if w == "AND" || w == "OR" || w == "NOT" {
|
||||
|
@ -140,152 +137,194 @@ pub fn db_path() -> Result<PathBuf> {
|
|||
// }
|
||||
//}
|
||||
//
|
||||
//
|
||||
pub async fn insert(
|
||||
envelope: Envelope,
|
||||
backend: Arc<RwLock<Box<dyn MailBackend>>>,
|
||||
acc_name: String,
|
||||
) -> Result<()> {
|
||||
let db_path = db_path()?;
|
||||
if !db_path.exists() {
|
||||
return Err(Error::new(
|
||||
"Database hasn't been initialised. Run `reindex` command",
|
||||
));
|
||||
}
|
||||
|
||||
let conn = melib_sqlite3::open_db(db_path)?;
|
||||
pub struct AccountCache;
|
||||
|
||||
let op = backend
|
||||
.read()
|
||||
.unwrap()
|
||||
.operation(envelope.hash())?
|
||||
.as_bytes()?;
|
||||
impl AccountCache {
|
||||
pub async fn insert(
|
||||
envelope: Envelope,
|
||||
backend: Arc<RwLock<Box<dyn MailBackend>>>,
|
||||
acc_name: String,
|
||||
) -> Result<()> {
|
||||
let db_desc = DatabaseDescription {
|
||||
identifier: Some(acc_name.clone().into()),
|
||||
..DB.clone()
|
||||
};
|
||||
|
||||
let body = match op.await.map(|bytes| envelope.body_bytes(&bytes)) {
|
||||
Ok(body) => body.text(),
|
||||
Err(err) => {
|
||||
log::error!(
|
||||
"Failed to open envelope {}: {err}",
|
||||
envelope.message_id_display(),
|
||||
);
|
||||
return Err(err);
|
||||
if !db_desc.exists().unwrap_or(false) {
|
||||
return Err(Error::new(format!(
|
||||
"Database hasn't been initialised. Run `reindex {acc_name}` command"
|
||||
)));
|
||||
}
|
||||
};
|
||||
|
||||
if let Err(err) = conn.execute(
|
||||
"INSERT OR IGNORE INTO accounts (name) VALUES (?1)",
|
||||
params![acc_name,],
|
||||
) {
|
||||
log::error!(
|
||||
"Failed to insert envelope {}: {err}",
|
||||
envelope.message_id_display(),
|
||||
);
|
||||
return Err(Error::new(err.to_string()));
|
||||
}
|
||||
let account_id: i32 = {
|
||||
let mut stmt = conn
|
||||
.prepare("SELECT id FROM accounts WHERE name = ?")
|
||||
.unwrap();
|
||||
let x = stmt
|
||||
.query_map(params![acc_name], |row| row.get(0))
|
||||
let op = backend
|
||||
.read()
|
||||
.unwrap()
|
||||
.next()
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
x
|
||||
};
|
||||
if let Err(err) = conn
|
||||
.execute(
|
||||
"INSERT OR REPLACE INTO envelopes (account_id, hash, date, _from, _to, cc, bcc, \
|
||||
subject, message_id, in_reply_to, _references, flags, has_attachments, body_text, \
|
||||
timestamp)
|
||||
.operation(envelope.hash())?
|
||||
.as_bytes()?;
|
||||
|
||||
let body = match op.await.map(|bytes| envelope.body_bytes(&bytes)) {
|
||||
Ok(body) => body.text(),
|
||||
Err(err) => {
|
||||
log::error!(
|
||||
"Failed to open envelope {}: {err}",
|
||||
envelope.message_id_display(),
|
||||
);
|
||||
return Err(err);
|
||||
}
|
||||
};
|
||||
smol::unblock(move || {
|
||||
let mut conn = db_desc.open_or_create_db()?;
|
||||
|
||||
let tx =
|
||||
conn.transaction_with_behavior(melib::rusqlite::TransactionBehavior::Immediate)?;
|
||||
if let Err(err) = tx.execute(
|
||||
"INSERT OR IGNORE INTO accounts (name) VALUES (?1)",
|
||||
params![acc_name,],
|
||||
) {
|
||||
log::error!(
|
||||
"Failed to insert envelope {}: {err}",
|
||||
envelope.message_id_display(),
|
||||
);
|
||||
return Err(Error::new(format!(
|
||||
"Failed to insert envelope {}: {err}",
|
||||
envelope.message_id_display(),
|
||||
)));
|
||||
}
|
||||
let account_id: i32 = {
|
||||
let mut stmt = tx
|
||||
.prepare("SELECT id FROM accounts WHERE name = ?")
|
||||
.unwrap();
|
||||
let x = stmt
|
||||
.query_map(params![acc_name], |row| row.get(0))
|
||||
.unwrap()
|
||||
.next()
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
x
|
||||
};
|
||||
if let Err(err) = tx
|
||||
.execute(
|
||||
"INSERT OR REPLACE INTO envelopes (account_id, hash, date, _from, _to, cc, \
|
||||
bcc, subject, message_id, in_reply_to, _references, flags, has_attachments, \
|
||||
body_text, timestamp)
|
||||
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15)",
|
||||
params![
|
||||
account_id,
|
||||
envelope.hash().to_be_bytes().to_vec(),
|
||||
envelope.date_as_str(),
|
||||
envelope.field_from_to_string(),
|
||||
envelope.field_to_to_string(),
|
||||
envelope.field_cc_to_string(),
|
||||
envelope.field_bcc_to_string(),
|
||||
envelope.subject().into_owned().trim_end_matches('\u{0}'),
|
||||
envelope.message_id_display().to_string(),
|
||||
envelope
|
||||
.in_reply_to_display()
|
||||
.map(|f| f.to_string())
|
||||
.unwrap_or_default(),
|
||||
envelope.field_references_to_string(),
|
||||
i64::from(envelope.flags().bits()),
|
||||
if envelope.has_attachments() { 1 } else { 0 },
|
||||
body,
|
||||
envelope.date().to_be_bytes().to_vec()
|
||||
],
|
||||
)
|
||||
.map_err(|e| Error::new(e.to_string()))
|
||||
{
|
||||
log::error!(
|
||||
"Failed to insert envelope {}: {err}",
|
||||
envelope.message_id_display(),
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn remove(env_hash: EnvelopeHash) -> Result<()> {
|
||||
let db_path = db_path()?;
|
||||
if !db_path.exists() {
|
||||
return Err(Error::new(
|
||||
"Database hasn't been initialised. Run `reindex` command",
|
||||
));
|
||||
params![
|
||||
account_id,
|
||||
envelope.hash().to_be_bytes().to_vec(),
|
||||
envelope.date_as_str(),
|
||||
envelope.field_from_to_string(),
|
||||
envelope.field_to_to_string(),
|
||||
envelope.field_cc_to_string(),
|
||||
envelope.field_bcc_to_string(),
|
||||
envelope.subject().into_owned().trim_end_matches('\u{0}'),
|
||||
envelope.message_id_display().to_string(),
|
||||
envelope
|
||||
.in_reply_to_display()
|
||||
.map(|f| f.to_string())
|
||||
.unwrap_or_default(),
|
||||
envelope.field_references_to_string(),
|
||||
i64::from(envelope.flags().bits()),
|
||||
i32::from(envelope.has_attachments()),
|
||||
body,
|
||||
envelope.date().to_be_bytes().to_vec()
|
||||
],
|
||||
)
|
||||
.map_err(|e| Error::new(e.to_string()))
|
||||
{
|
||||
drop(tx);
|
||||
log::error!(
|
||||
"Failed to insert envelope {}: {err}",
|
||||
envelope.message_id_display(),
|
||||
);
|
||||
} else {
|
||||
tx.commit()?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
let conn = melib_sqlite3::open_db(db_path)?;
|
||||
if let Err(err) = conn
|
||||
.execute(
|
||||
"DELETE FROM envelopes WHERE hash = ?",
|
||||
params![env_hash.to_be_bytes().to_vec(),],
|
||||
)
|
||||
.map_err(|e| Error::new(e.to_string()))
|
||||
{
|
||||
log::error!("Failed to remove envelope {env_hash}: {err}");
|
||||
return Err(err);
|
||||
pub async fn remove(acc_name: String, env_hash: EnvelopeHash) -> Result<()> {
|
||||
let db_desc = DatabaseDescription {
|
||||
identifier: Some(acc_name.clone().into()),
|
||||
..DB.clone()
|
||||
};
|
||||
let db_path = db_desc.db_path()?;
|
||||
if !db_path.exists() {
|
||||
return Err(Error::new(format!(
|
||||
"Database hasn't been initialised. Run `reindex {acc_name}` command"
|
||||
)));
|
||||
}
|
||||
|
||||
smol::unblock(move || {
|
||||
let mut conn = db_desc.open_or_create_db()?;
|
||||
let tx =
|
||||
conn.transaction_with_behavior(melib::rusqlite::TransactionBehavior::Immediate)?;
|
||||
if let Err(err) = tx.execute(
|
||||
"DELETE FROM envelopes WHERE hash = ?",
|
||||
params![env_hash.to_be_bytes().to_vec(),],
|
||||
) {
|
||||
drop(tx);
|
||||
log::error!("Failed to remove envelope {env_hash}: {err}");
|
||||
return Err(Error::new(format!(
|
||||
"Failed to remove envelope {env_hash}: {err}"
|
||||
)));
|
||||
}
|
||||
tx.commit()?;
|
||||
Ok(())
|
||||
})
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn index(context: &mut crate::state::Context, account_index: usize) -> ResultFuture<()> {
|
||||
let account = &context.accounts[account_index];
|
||||
let (acc_name, acc_mutex, backend_mutex): (String, Arc<RwLock<_>>, Arc<_>) = (
|
||||
account.name().to_string(),
|
||||
account.collection.envelopes.clone(),
|
||||
account.backend.clone(),
|
||||
);
|
||||
let conn = melib_sqlite3::open_or_create_db(&DB, Some(acc_name.as_str()))?;
|
||||
let env_hashes = acc_mutex
|
||||
.read()
|
||||
.unwrap()
|
||||
.keys()
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
pub async fn index(
|
||||
acc_name: Arc<String>,
|
||||
collection: melib::Collection,
|
||||
backend_mutex: Arc<RwLock<Box<dyn MailBackend>>>,
|
||||
) -> Result<()> {
|
||||
let acc_mutex = collection.envelopes.clone();
|
||||
let db_desc = Arc::new(DatabaseDescription {
|
||||
identifier: Some(acc_name.to_string().into()),
|
||||
..DB.clone()
|
||||
});
|
||||
let env_hashes = acc_mutex
|
||||
.read()
|
||||
.unwrap()
|
||||
.keys()
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
/* Sleep, index and repeat in order not to block the main process */
|
||||
Ok(Box::pin(async move {
|
||||
conn.execute(
|
||||
"INSERT OR REPLACE INTO accounts (name) VALUES (?1)",
|
||||
params![acc_name.as_str(),],
|
||||
)
|
||||
.chain_err_summary(|| "Failed to update index:")?;
|
||||
/* Sleep, index and repeat in order not to block the main process */
|
||||
let account_id: i32 = {
|
||||
let mut stmt = conn
|
||||
.prepare("SELECT id FROM accounts WHERE name = ?")
|
||||
.unwrap();
|
||||
let x = stmt
|
||||
.query_map(params![acc_name.as_str()], |row| row.get(0))
|
||||
.unwrap()
|
||||
.next()
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
x
|
||||
let acc_name = Arc::clone(&acc_name);
|
||||
let db_desc = Arc::clone(&db_desc);
|
||||
smol::unblock(move || {
|
||||
let mut conn = db_desc.open_or_create_db()?;
|
||||
let tx = conn
|
||||
.transaction_with_behavior(melib::rusqlite::TransactionBehavior::Immediate)?;
|
||||
tx.execute(
|
||||
"INSERT OR REPLACE INTO accounts (name) VALUES (?1)",
|
||||
params![acc_name.as_str(),],
|
||||
)
|
||||
.chain_err_summary(|| "Failed to update index:")?;
|
||||
let account_id = {
|
||||
let mut stmt = tx
|
||||
.prepare("SELECT id FROM accounts WHERE name = ?")
|
||||
.unwrap();
|
||||
let x = stmt
|
||||
.query_map(params![acc_name.as_str()], |row| row.get(0))
|
||||
.unwrap()
|
||||
.next()
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
x
|
||||
};
|
||||
tx.commit()?;
|
||||
Ok::<i32, Error>(account_id)
|
||||
})
|
||||
.await?
|
||||
};
|
||||
let mut ctr = 0;
|
||||
log::trace!(
|
||||
|
@ -296,90 +335,131 @@ pub fn index(context: &mut crate::state::Context, account_index: usize) -> Resul
|
|||
);
|
||||
for chunk in env_hashes.chunks(200) {
|
||||
ctr += chunk.len();
|
||||
for env_hash in chunk {
|
||||
let mut op = backend_mutex.read().unwrap().operation(*env_hash)?;
|
||||
let mut chunk_bytes = Vec::with_capacity(chunk.len());
|
||||
for &env_hash in chunk {
|
||||
let mut op = backend_mutex.read().unwrap().operation(env_hash)?;
|
||||
let bytes = op
|
||||
.as_bytes()?
|
||||
.await
|
||||
.chain_err_summary(|| format!("Failed to open envelope {}", env_hash))?;
|
||||
let envelopes_lck = acc_mutex.read().unwrap();
|
||||
if let Some(e) = envelopes_lck.get(env_hash) {
|
||||
let body = e.body_bytes(&bytes).text().replace('\0', "");
|
||||
conn.execute(
|
||||
"INSERT OR REPLACE INTO envelopes (account_id, hash, date, _from, _to, \
|
||||
cc, bcc, subject, message_id, in_reply_to, _references, flags, \
|
||||
has_attachments, body_text, timestamp)
|
||||
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15)",
|
||||
params![
|
||||
account_id,
|
||||
e.hash().to_be_bytes().to_vec(),
|
||||
e.date_as_str(),
|
||||
e.field_from_to_string(),
|
||||
e.field_to_to_string(),
|
||||
e.field_cc_to_string(),
|
||||
e.field_bcc_to_string(),
|
||||
e.subject().into_owned().trim_end_matches('\u{0}'),
|
||||
e.message_id_display().to_string(),
|
||||
e.in_reply_to_display()
|
||||
.map(|f| f.to_string())
|
||||
.unwrap_or_default(),
|
||||
e.field_references_to_string(),
|
||||
i64::from(e.flags().bits()),
|
||||
if e.has_attachments() { 1 } else { 0 },
|
||||
body,
|
||||
e.date().to_be_bytes().to_vec()
|
||||
],
|
||||
)
|
||||
.chain_err_summary(|| {
|
||||
format!("Failed to insert envelope {}", e.message_id_display())
|
||||
})?;
|
||||
}
|
||||
chunk_bytes.push((env_hash, bytes));
|
||||
}
|
||||
let sleep_dur = std::time::Duration::from_millis(20);
|
||||
std::thread::sleep(sleep_dur);
|
||||
{
|
||||
let acc_mutex = acc_mutex.clone();
|
||||
let db_desc = Arc::clone(&db_desc);
|
||||
smol::unblock(move || {
|
||||
let mut conn = db_desc.open_or_create_db()?;
|
||||
let tx = conn.transaction_with_behavior(
|
||||
melib::rusqlite::TransactionBehavior::Immediate,
|
||||
)?;
|
||||
let envelopes_lck = acc_mutex.read().unwrap();
|
||||
for (env_hash, bytes) in chunk_bytes {
|
||||
if let Some(e) = envelopes_lck.get(&env_hash) {
|
||||
let body = e.body_bytes(&bytes).text().replace('\0', "");
|
||||
tx.execute(
|
||||
"INSERT OR REPLACE INTO envelopes (account_id, hash, date, _from, \
|
||||
_to, cc, bcc, subject, message_id, in_reply_to, _references, \
|
||||
flags, has_attachments, body_text, timestamp)
|
||||
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15)",
|
||||
params![
|
||||
account_id,
|
||||
e.hash().to_be_bytes().to_vec(),
|
||||
e.date_as_str(),
|
||||
e.field_from_to_string(),
|
||||
e.field_to_to_string(),
|
||||
e.field_cc_to_string(),
|
||||
e.field_bcc_to_string(),
|
||||
e.subject().into_owned().trim_end_matches('\u{0}'),
|
||||
e.message_id_display().to_string(),
|
||||
e.in_reply_to_display()
|
||||
.map(|f| f.to_string())
|
||||
.unwrap_or_default(),
|
||||
e.field_references_to_string(),
|
||||
i64::from(e.flags().bits()),
|
||||
i32::from(e.has_attachments()),
|
||||
body,
|
||||
e.date().to_be_bytes().to_vec()
|
||||
],
|
||||
)
|
||||
.chain_err_summary(|| {
|
||||
format!("Failed to insert envelope {}", e.message_id_display())
|
||||
})?;
|
||||
}
|
||||
}
|
||||
tx.commit()?;
|
||||
Ok::<(), Error>(())
|
||||
})
|
||||
.await?;
|
||||
}
|
||||
let sleep_dur = std::time::Duration::from_millis(50);
|
||||
smol::Timer::after(sleep_dur).await;
|
||||
}
|
||||
Ok(())
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn search(
|
||||
query: &Query,
|
||||
(sort_field, sort_order): (SortField, SortOrder),
|
||||
) -> ResultFuture<SmallVec<[EnvelopeHash; 512]>> {
|
||||
let db_path = db_path()?;
|
||||
if !db_path.exists() {
|
||||
return Err(Error::new(
|
||||
"Database hasn't been initialised. Run `reindex` command",
|
||||
));
|
||||
}
|
||||
|
||||
let conn = melib_sqlite3::open_db(db_path)?;
|
||||
pub async fn search(
|
||||
acc_name: String,
|
||||
query: Query,
|
||||
(sort_field, sort_order): (SortField, SortOrder),
|
||||
) -> Result<SmallVec<[EnvelopeHash; 512]>> {
|
||||
let db_desc = DatabaseDescription {
|
||||
identifier: Some(acc_name.clone().into()),
|
||||
..DB.clone()
|
||||
};
|
||||
|
||||
let sort_field = match sort_field {
|
||||
SortField::Subject => "subject",
|
||||
SortField::Date => "timestamp",
|
||||
};
|
||||
if !db_desc.exists().unwrap_or(false) {
|
||||
return Err(Error::new(format!(
|
||||
"Database hasn't been initialised for account `{}`. Run `reindex` command to \
|
||||
build an index.",
|
||||
acc_name
|
||||
)));
|
||||
}
|
||||
let query = query_to_sql(&query);
|
||||
|
||||
let sort_order = match sort_order {
|
||||
SortOrder::Asc => "ASC",
|
||||
SortOrder::Desc => "DESC",
|
||||
};
|
||||
smol::unblock(move || {
|
||||
let mut conn = db_desc.open_or_create_db()?;
|
||||
|
||||
let mut stmt = conn
|
||||
.prepare(&format!(
|
||||
"SELECT hash FROM envelopes WHERE {} ORDER BY {} {};",
|
||||
query_to_sql(query),
|
||||
sort_field,
|
||||
sort_order
|
||||
))
|
||||
.map_err(|e| Error::new(e.to_string()))?;
|
||||
let sort_field = match sort_field {
|
||||
SortField::Subject => "subject",
|
||||
SortField::Date => "timestamp",
|
||||
};
|
||||
|
||||
let results = stmt
|
||||
.query_map([], |row| row.get::<_, EnvelopeHash>(0))
|
||||
.map_err(Error::from)?
|
||||
.map(|item| item.map_err(Error::from))
|
||||
.collect::<Result<SmallVec<[EnvelopeHash; 512]>>>();
|
||||
Ok(Box::pin(async { results }))
|
||||
let sort_order = match sort_order {
|
||||
SortOrder::Asc => "ASC",
|
||||
SortOrder::Desc => "DESC",
|
||||
};
|
||||
|
||||
let tx = conn.transaction()?;
|
||||
let mut stmt = tx
|
||||
.prepare(&format!(
|
||||
"SELECT hash FROM envelopes WHERE {} ORDER BY {} {};",
|
||||
query, sort_field, sort_order
|
||||
))
|
||||
.map_err(|e| Error::new(e.to_string()))?;
|
||||
|
||||
#[allow(clippy::let_and_return)] // false positive, the let binding is needed
|
||||
// for the temporary to live long enough
|
||||
let x = stmt
|
||||
.query_map([], |row| row.get::<_, EnvelopeHash>(0))
|
||||
.map_err(Error::from)?
|
||||
.map(|item| item.map_err(Error::from))
|
||||
.collect::<Result<SmallVec<[EnvelopeHash; 512]>>>();
|
||||
x
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
pub fn db_path(acc_name: &str) -> Result<Option<PathBuf>> {
|
||||
let db_desc = DatabaseDescription {
|
||||
identifier: Some(acc_name.to_string().into()),
|
||||
..DB.clone()
|
||||
};
|
||||
let db_path = db_desc.db_path()?;
|
||||
if !db_path.exists() {
|
||||
return Ok(None);
|
||||
}
|
||||
Ok(Some(db_path))
|
||||
}
|
||||
}
|
||||
|
||||
/// Translates a `Query` to an Sqlite3 expression in a `String`.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -57,7 +57,7 @@ pub fn edit_config() -> Result<()> {
|
|||
})?;
|
||||
let config_path = crate::conf::get_config_file()?;
|
||||
|
||||
let mut cmd = Command::new(&editor);
|
||||
let mut cmd = Command::new(editor);
|
||||
|
||||
let mut handle = &mut cmd;
|
||||
for c in crate::conf::get_included_configs(config_path)? {
|
||||
|
@ -134,7 +134,7 @@ pub fn pager(v: String, no_raw: Option<Option<bool>>) -> Result<()> {
|
|||
|
||||
#[cfg(not(feature = "cli-docs"))]
|
||||
pub fn man(_: ManOpt) -> Result<()> {
|
||||
Err(Error::new("error: this version of meli was not build with embedded documentation (cargo feature `cli-docs`). You might have it installed as manpages (eg `man meli`), otherwise check https://meli.delivery"))
|
||||
Err(Error::new("error: this version of meli was not build with embedded documentation (cargo feature `cli-docs`). You might have it installed as manpages (eg `man meli`), otherwise check https://meli-email.org"))
|
||||
}
|
||||
|
||||
pub fn compiled_with() -> Result<()> {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
use std::{collections::BTreeMap, io::Write};
|
||||
|
||||
use super::*;
|
||||
use crate::melib::text_processing::TextProcessing;
|
||||
use crate::melib::text::TextProcessing;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SVGScreenshotFilter {
|
||||
|
@ -37,7 +37,7 @@ impl std::fmt::Display for SVGScreenshotFilter {
|
|||
|
||||
impl SVGScreenshotFilter {
|
||||
pub fn new() -> Self {
|
||||
SVGScreenshotFilter {
|
||||
Self {
|
||||
save_screenshot: false,
|
||||
id: ComponentId::default(),
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ impl Default for SVGScreenshotFilter {
|
|||
}
|
||||
|
||||
impl Component for SVGScreenshotFilter {
|
||||
fn draw(&mut self, _grid: &mut CellBuffer, _area: Area, context: &mut Context) {
|
||||
fn draw(&mut self, _grid: &mut CellBuffer, area: Area, context: &mut Context) {
|
||||
if !self.save_screenshot {
|
||||
return;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ impl Component for SVGScreenshotFilter {
|
|||
* rectangle element
|
||||
* inserted along with the `use` elements
|
||||
*
|
||||
* Each row is arbritarily set at 17px high, and each character cell is 8
|
||||
* Each row is arbitrarily set at 17px high, and each character cell is 8
|
||||
* pixels wide. Rectangle cells each have one extra pixel (so 18px *
|
||||
* 9px) in their dimensions in order to cover the spacing between
|
||||
* cells.
|
||||
|
@ -89,7 +89,7 @@ impl Component for SVGScreenshotFilter {
|
|||
|
||||
/* keep a map with used colors and write a stylesheet when we're done */
|
||||
let mut classes: BTreeMap<(u8, u8, u8), usize> = BTreeMap::new();
|
||||
for (row_idx, row) in grid.bounds_iter(((0, 0), (width, height))).enumerate() {
|
||||
for (row_idx, row) in grid.bounds_iter(area).enumerate() {
|
||||
text.clear();
|
||||
escaped_text.clear();
|
||||
/* Each row is a <g> group element, consisting of text elements */
|
||||
|
@ -98,7 +98,7 @@ impl Component for SVGScreenshotFilter {
|
|||
* - Whenever the foreground color changes, emit a text element with the
|
||||
* accumulated
|
||||
* text in the specific foreground color.
|
||||
* - Whenever the backgrund color changes, emit a rectangle element filled
|
||||
* - Whenever the background color changes, emit a rectangle element filled
|
||||
* with the
|
||||
* specific background color.
|
||||
*/
|
||||
|
@ -424,26 +424,29 @@ impl Component for SVGScreenshotFilter {
|
|||
.unwrap()
|
||||
.write_all(&res)
|
||||
.unwrap();
|
||||
context.replies.push_back(UIEvent::Notification(
|
||||
Some("Screenshot saved".into()),
|
||||
format!("Screenshot saved to {}", filename),
|
||||
None,
|
||||
));
|
||||
context.replies.push_back(UIEvent::Notification {
|
||||
title: Some("Screenshot saved".into()),
|
||||
source: None,
|
||||
body: format!("Screenshot saved to {filename}").into(),
|
||||
kind: None,
|
||||
});
|
||||
}
|
||||
|
||||
fn process_event(&mut self, event: &mut UIEvent, _context: &mut Context) -> bool {
|
||||
if let UIEvent::Input(Key::F(6)) = event {
|
||||
if matches!(
|
||||
event,
|
||||
UIEvent::Input(Key::F(6)) | UIEvent::CmdInput(Key::F(6))
|
||||
) {
|
||||
self.save_screenshot = true;
|
||||
true
|
||||
} else if let UIEvent::CmdInput(Key::F(6)) = event {
|
||||
self.save_screenshot = true;
|
||||
true
|
||||
} else if let UIEvent::EmbedInput((Key::F(6), _)) = event {
|
||||
} else if matches!(event, UIEvent::EmbeddedInput((Key::F(6), _))) {
|
||||
self.save_screenshot = true;
|
||||
false
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn set_dirty(&mut self, _value: bool) {}
|
||||
|
||||
fn is_dirty(&self) -> bool {
|
||||
|
|
|
@ -28,20 +28,42 @@ mod color;
|
|||
mod screen;
|
||||
pub use color::*;
|
||||
#[macro_use]
|
||||
pub mod position;
|
||||
#[macro_use]
|
||||
pub mod cells;
|
||||
#[macro_use]
|
||||
pub mod keys;
|
||||
pub mod embed;
|
||||
pub mod embedded;
|
||||
pub mod text_editing;
|
||||
|
||||
use std::io::{BufRead, Write};
|
||||
|
||||
pub use braille::BraillePixelIter;
|
||||
pub use screen::{Screen, StateStdout};
|
||||
pub use screen::{Area, Screen, ScreenGeneration, StateStdout, Tty, Virtual};
|
||||
|
||||
pub use self::{cells::*, keys::*, position::*, text_editing::*};
|
||||
pub use self::{cells::*, keys::*, text_editing::*};
|
||||
|
||||
/// A type alias for a `(x, y)` position on screen.
|
||||
pub type Pos = (usize, usize);
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
|
||||
pub enum Alignment {
|
||||
/// Stretch to fill all space if possible, center if no meaningful way to
|
||||
/// stretch.
|
||||
Fill,
|
||||
/// Snap to left or top side, leaving space on right or bottom.
|
||||
Start,
|
||||
/// Snap to right or bottom side, leaving space on left or top.
|
||||
End,
|
||||
/// Center natural width of widget inside the allocation.
|
||||
#[default]
|
||||
Center,
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! emoji_text_presentation_selector {
|
||||
() => {
|
||||
'\u{FE0E}'
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* CSI events we use
|
||||
|
|
|
@ -145,7 +145,7 @@ pub struct BraillePixelIter {
|
|||
|
||||
impl From<&[u16]> for BraillePixelIter {
|
||||
fn from(from: &[u16]) -> Self {
|
||||
BraillePixelIter {
|
||||
Self {
|
||||
columns: [
|
||||
Braille16bitColumn {
|
||||
bitmaps: (
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loadingā¦
Reference in New Issue