Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a basic test server setup #266

Merged
merged 12 commits into from
Nov 12, 2023
94 changes: 72 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[workspace]
resolver = "2"

members = [
"app"
"app",
"test_server",
]
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ has since become a vehicle for me to learn and experiment. It will likely never
be finished. Anyway, the experience of rewriting this in Rust has been very
nice. Go learn Rust!

## Building
## Developing

## Requirements
### Requirements

Install flatpak runtimes:

Expand Down Expand Up @@ -51,7 +51,7 @@ To build the application then:

```shell
mkdir build && cd build
meson setup --prefix=/app ..
meson setup --prefix=/app -D profile=devel ..
ninja
```

Expand All @@ -67,7 +67,21 @@ Then you will simply be able to run the application from the `PATH` by simply ru
envoyer
```

### License
### Testing

A test server is available to test the application against. To start the server, run the command below. `docker` needs to be available.

```
cargo run --bin test_server
```

Then running `envoyer` like so should get it to connect to the test server:

```
envoyer --with-test-server
```

## License

Copyright 2016-2021 Andrei-Costin Zisu.

Expand Down
5 changes: 4 additions & 1 deletion app/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use std::env;
use std::path::PathBuf;

fn main() {
let clang_lib_path = env::var("CLANG_LIB_PATH").unwrap();
let clang_lib_path = env::var("CLANG_LIB_PATH").expect(
"CLANG_LIB_PATH is not set.\
Make sure you are building from the flatpak environment",
);
let out_path = env::var("OUT_DIR").unwrap();
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();

Expand Down
5 changes: 5 additions & 0 deletions app/migrations/2023-10-29-185220_add_fields_for_imap/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE identities DROP COLUMN imap_password;
ALTER TABLE identities DROP COLUMN imap_server_hostname;
ALTER TABLE identities DROP COLUMN imap_server_port;
ALTER TABLE identities DROP COLUMN imap_use_tls;
ALTER TABLE identities DROP COLUMN imap_use_starttls;
5 changes: 5 additions & 0 deletions app/migrations/2023-10-29-185220_add_fields_for_imap/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE identities ADD COLUMN imap_password TEXT;
ALTER TABLE identities ADD COLUMN imap_server_hostname TEXT NOT NULL DEFAULT 'imap.gmail.com';
ALTER TABLE identities ADD COLUMN imap_server_port INTEGER NOT NULL DEFAULT 993;
ALTER TABLE identities ADD COLUMN imap_use_tls BOOLEAN NOT NULL DEFAULT true;
ALTER TABLE identities ADD COLUMN imap_use_starttls BOOLEAN NOT NULL DEFAULT false;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
CREATE TABLE messages_new (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
message_id TEXT NOT NULL,
subject TEXT NOT NULL,
folder_id INTEGER NOT NULL,
time_received TIMESTAMP NOT NULL,
"from" TEXT NOT NULL,
"to" TEXT NOT NULL,
cc TEXT NOT NULL,
bcc TEXT NOT NULL,
content TEXT,
"references" TEXT NOT NULL,
in_reply_to TEXT NOT NULL,
uid INTEGER NOT NULL,
modification_sequence INTEGER NOT NULL,
seen BOOLEAN NOT NULL,
flagged BOOLEAN NOT NULL,
draft BOOLEAN NOT NULL,
deleted BOOLEAN NOT NULL
);

INSERT INTO messages_new SELECT * FROM messages;
DROP TABLE messages;
ALTER TABLE messages_new RENAME TO messages;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
CREATE TABLE messages_new (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
message_id TEXT NOT NULL,
subject TEXT NOT NULL,
folder_id INTEGER NOT NULL,
time_received TIMESTAMP NOT NULL,
"from" TEXT NOT NULL,
"to" TEXT NOT NULL,
cc TEXT NOT NULL,
bcc TEXT NOT NULL,
content TEXT,
"references" TEXT NOT NULL,
in_reply_to TEXT NOT NULL,
uid INTEGER NOT NULL,
modification_sequence INTEGER NULL,
seen BOOLEAN NOT NULL,
flagged BOOLEAN NOT NULL,
draft BOOLEAN NOT NULL,
deleted BOOLEAN NOT NULL
);

INSERT INTO messages_new SELECT * FROM messages;
DROP TABLE messages;
ALTER TABLE messages_new RENAME TO messages;
Loading