Check-in [3d13e7f81d]
Logged in as anonymous
Overview
Comment:fix markdown, condense From: and Date: to one line (better rework that later)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | v0.3.3
Files: files | file ages | folders
SHA3-256: 3d13e7f81d1e4203c2407de4024878d4718f0553b807c2a0589f3a076d5535b0
User & Date: arcade on 2024-12-28 09:27:29.705
Other Links: manifest | tags
Context
2025-01-21
19:31
add arg parsing check-in: e66352b9cc user: arcade tags: trunk, v0.3.4
2024-12-28
09:27
fix markdown, condense From: and Date: to one line (better rework that later) check-in: 3d13e7f81d user: arcade tags: trunk, v0.3.3
2024-12-27
15:29
bump, add option to filter header fields and also add "Date:" by default check-in: 28fde40f7a user: arcade tags: trunk, v0.3.2
Changes
1840
1841
1842
1843
1844
1845
1846
1847

1848
1849
1850
1851
1852
1853
1854
1840
1841
1842
1843
1844
1845
1846

1847
1848
1849
1850
1851
1852
1853
1854







-
+







name = "smallvec"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"

[[package]]
name = "smtp2tg"
version = "0.3.2"
version = "0.3.3"
dependencies = [
 "anyhow",
 "async-std",
 "config",
 "mail-parser",
 "mailin-embedded",
 "teloxide",
1
2
3

4
5
6
7
8
9
10
1
2

3
4
5
6
7
8
9
10


-
+







[package]
name = "smtp2tg"
version = "0.3.2"
version = "0.3.3"
authors = [ "arcade" ]
edition = "2021"

[dependencies]
anyhow = "1.0.86"
async-std = { version = "1.12.0", features = [ "attributes", "tokio1" ] }
config = { version = "=0.14.0", default-features = false, features = [ "toml" ] } # Rust 1.75
143
144
145
146
147
148
149
150

151
152

153
154


155
156

157
158
159
160

161
162
163
164


165
166
167
168
169
170
171
143
144
145
146
147
148
149

150
151

152
153
154
155
156
157

158
159
160
161

162
163
164


165
166
167
168
169
170
171
172
173







-
+

-
+


+
+

-
+



-
+


-
-
+
+







					.ok_or(anyhow!("Missing default address in recipient table."))?);
			};

			// prepating message header
			let mut reply: Vec<Cow<'_, str>> = vec![];
			if self.fields.contains("subject") {
				if let Some(subject) = mail.subject() {
					reply.push(format!("**Subject:** `{}`", subject).into());
					reply.push(format!("__*Subject:*__ `{}`", subject).into());
				} else if let Some(thread) = mail.thread_name() {
					reply.push(format!("**Thread:** `{}`", thread).into());
					reply.push(format!("__*Thread:*__ `{}`", thread).into());
				}
			}
			let mut short_headers: Vec<Cow<'_, str>> = vec![];
			// do we need to replace spaces here?
			if self.fields.contains("from") {
				reply.push(format!("**From:** `{}`", headers.from).into());
				short_headers.push(format!("__*From:*__ `{}`", headers.from).into());
			}
			if self.fields.contains("date") {
				if let Some(date) = mail.date() {
					reply.push(format!("**Date:** `{}`", date).into());
					short_headers.push(format!("__*Date:*__ `{}`", date).into());
				}
			}
			reply.push("".into());
			let header_size = reply.join("\n").len() + 1;
			reply.push(short_headers.join(" ").into());
			let header_size = reply.join(" ").len() + 1;

			let html_parts = mail.html_body_count();
			let text_parts = mail.text_body_count();
			let attachments = mail.attachment_count();
			if html_parts != text_parts {
				self.debug(format!("Hm, we have {} HTML parts and {} text parts\\.", html_parts, text_parts)).await?;
			}