Check-in [866aad57a4]
Logged in as anonymous
Overview
Comment:use more, add real versions, just yank in text lines
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 866aad57a43ec512c13fa23bc22e16a8f246ad0c2ed18f27ac23f49b528328e7
User & Date: arcade on 2024-06-15 10:18:41.136
Other Links: manifest | tags
Context
2024-07-09
12:29
v0.2.4: ditch zerovec vuln check-in: 7beea08af5 user: arcade tags: trunk, v0.2.4
2024-06-15
10:18
use more, add real versions, just yank in text lines check-in: 866aad57a4 user: arcade tags: trunk
2024-06-13
08:36
v0.2.3: import less from samotop (removes security issue) check-in: 3ce249c1a4 user: arcade tags: trunk
Changes
1
2
3
4
5
6
7

8
9

10
11
12
13
14
15
16
1
2
3
4
5
6

7
8

9
10
11
12
13
14
15
16






-
+

-
+







# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "addr2line"
version = "0.15.2"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7a2e47a1fbe209ee101dd6d61285226744c6c8d3c21c8dc878ba6cb9f467f3a"
checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
dependencies = [
 "gimli",
]

[[package]]
name = "adler"
version = "1.0.2"
138
139
140
141
142
143
144
145

146
147
148
149
150
151
152
138
139
140
141
142
143
144

145
146
147
148
149
150
151
152







-
+







dependencies = [
 "async-lock 3.4.0",
 "cfg-if",
 "concurrent-queue",
 "futures-io",
 "futures-lite 2.3.0",
 "parking",
 "polling 3.7.1",
 "polling 3.7.2",
 "rustix 0.38.34",
 "slab",
 "tracing",
 "windows-sys 0.52.0",
]

[[package]]
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266

267
268

269
270
271
272
273
274
275
234
235
236
237
238
239
240











241
242
243
244
245
246
247
248
249
250
251
252
253
254

255
256

257
258
259
260
261
262
263
264







-
-
-
-
-
-
-
-
-
-
-














-
+

-
+








[[package]]
name = "async-task"
version = "4.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"

[[package]]
name = "async-trait"
version = "0.1.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.66",
]

[[package]]
name = "atomic-waker"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"

[[package]]
name = "autocfg"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"

[[package]]
name = "backtrace"
version = "0.3.59"
version = "0.3.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4717cfcbfaa661a0fd48f8453951837ae7e8f81e481fbb136e3202d72805a744"
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
dependencies = [
 "addr2line",
 "cc",
 "cfg-if",
 "libc",
 "miniz_oxide",
 "object",
365
366
367
368
369
370
371
372

373
374

375
376
377
378
379
380
381
382
383
354
355
356
357
358
359
360

361
362

363
364

365
366
367
368
369
370
371







-
+

-
+

-







checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
dependencies = [
 "crossbeam-utils",
]

[[package]]
name = "config"
version = "0.13.4"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23738e11972c7643e4ec947840fc463b6a571afcd3e735bdfce7d03c7a784aca"
checksum = "7328b20597b53c2454f0b1919720c25c7339051c02b72b7e05409e00b14132be"
dependencies = [
 "async-trait",
 "lazy_static",
 "nom 7.1.3",
 "pathdiff",
 "serde",
 "toml",
]

742
743
744
745
746
747
748
749

750
751

752
753
754
755
756
757
758
730
731
732
733
734
735
736

737
738

739
740
741
742
743
744
745
746







-
+

-
+







 "cfg-if",
 "libc",
 "wasi",
]

[[package]]
name = "gimli"
version = "0.24.0"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189"
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"

[[package]]
name = "gloo-timers"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c"
dependencies = [
789
790
791
792
793
794
795






796
797
798
799
800
801
802
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796







+
+
+
+
+
+








[[package]]
name = "hermit-abi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"

[[package]]
name = "hermit-abi"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"

[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"

[[package]]
1052
1053
1054
1055
1056
1057
1058
1059

1060
1061
1062
1063
1064
1065
1066
1046
1047
1048
1049
1050
1051
1052

1053
1054
1055
1056
1057
1058
1059
1060







-
+








[[package]]
name = "io-lifetimes"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
dependencies = [
 "hermit-abi",
 "hermit-abi 0.3.9",
 "libc",
 "windows-sys 0.48.0",
]

[[package]]
name = "ipnet"
version = "2.9.0"
1180
1181
1182
1183
1184
1185
1186
1187

1188
1189

1190
1191
1192
1193
1194
1195
1196
1174
1175
1176
1177
1178
1179
1180

1181
1182

1183
1184
1185
1186
1187
1188
1189
1190







-
+

-
+







name = "match_cfg"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4"

[[package]]
name = "memchr"
version = "2.3.4"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"

[[package]]
name = "mime"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"

1208
1209
1210
1211
1212
1213
1214
1215

1216
1217

1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1202
1203
1204
1205
1206
1207
1208

1209
1210

1211
1212
1213

1214
1215
1216
1217
1218
1219
1220







-
+

-
+


-







name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"

[[package]]
name = "miniz_oxide"
version = "0.4.4"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae"
dependencies = [
 "adler",
 "autocfg",
]

[[package]]
name = "mio"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
1252
1253
1254
1255
1256
1257
1258
1259

1260
1261

1262
1263
1264
1265
1266
1267
1268
1245
1246
1247
1248
1249
1250
1251

1252
1253

1254
1255
1256
1257
1258
1259
1260
1261







-
+

-
+







name = "never"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c96aba5aa877601bb3f6dd6a63a969e1f82e60646e81e71b14496995e9853c91"

[[package]]
name = "nom"
version = "6.2.2"
version = "6.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6a7a9657c84d5814c6196b68bb4429df09c18b1573806259fba397ea4ad0d44"
checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2"
dependencies = [
 "bitvec",
 "funty",
 "lexical-core",
 "memchr",
 "version_check",
]
1288
1289
1290
1291
1292
1293
1294
1295

1296
1297
1298
1299
1300
1301

1302
1303




1304
1305
1306
1307
1308
1309
1310
1281
1282
1283
1284
1285
1286
1287

1288
1289
1290
1291
1292
1293

1294
1295

1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306







-
+





-
+

-
+
+
+
+








[[package]]
name = "num_cpus"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
 "hermit-abi",
 "hermit-abi 0.3.9",
 "libc",
]

[[package]]
name = "object"
version = "0.24.0"
version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a5b3dd1c072ee7963717671d1ca129f1048fda25edea6b752bfc71ac8854170"
checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434"
dependencies = [
 "memchr",
]

[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"

1466
1467
1468
1469
1470
1471
1472
1473

1474
1475

1476
1477
1478
1479

1480
1481
1482
1483
1484
1485
1486
1462
1463
1464
1465
1466
1467
1468

1469
1470

1471
1472
1473
1474

1475
1476
1477
1478
1479
1480
1481
1482







-
+

-
+



-
+







 "log",
 "pin-project-lite 0.2.14",
 "windows-sys 0.48.0",
]

[[package]]
name = "polling"
version = "3.7.1"
version = "3.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e6a007746f34ed64099e88783b0ae369eaa3da6392868ba262e2af9b8fbaea1"
checksum = "a3ed00ed3fbf728b5816498ecd316d1716eecaced9c0c8d2c5a6740ca214985b"
dependencies = [
 "cfg-if",
 "concurrent-queue",
 "hermit-abi",
 "hermit-abi 0.4.0",
 "pin-project-lite 0.2.14",
 "rustix 0.38.34",
 "tracing",
 "windows-sys 0.52.0",
]

[[package]]
1728
1729
1730
1731
1732
1733
1734
1735

1736
1737
1738
1739
1740
1741
1742
1724
1725
1726
1727
1728
1729
1730

1731
1732
1733
1734
1735
1736
1737
1738







-
+







 "base64 0.13.1",
 "bytes",
 "fast_chemail",
 "hostname",
 "log",
 "lozizol",
 "memchr",
 "nom 6.2.2",
 "nom 6.1.2",
 "pin-project",
 "pin-utils",
 "potential",
 "samotop-core",
 "serde",
 "serde_derive",
 "serde_json",
1835
1836
1837
1838
1839
1840
1841









1842
1843
1844
1845
1846
1847
1848
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853







+
+
+
+
+
+
+
+
+







source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
dependencies = [
 "itoa",
 "ryu",
 "serde",
]

[[package]]
name = "serde_spanned"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0"
dependencies = [
 "serde",
]

[[package]]
name = "serde_urlencoded"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [
1896
1897
1898
1899
1900
1901
1902
1903

1904
1905
1906
1907
1908
1909
1910
1901
1902
1903
1904
1905
1906
1907

1908
1909
1910
1911
1912
1913
1914
1915







-
+







dependencies = [
 "async-io 1.13.0",
 "pin-project-lite 0.1.12",
]

[[package]]
name = "smtp2tg"
version = "0.2.1"
version = "0.2.3"
dependencies = [
 "anyhow",
 "async-std",
 "config",
 "mail-parser",
 "samotop",
 "teloxide",
2202
2203
2204
2205
2206
2207
2208
2209

2210







2211






2212
2213













2214
2215
2216
2217
2218
2219
2220
2207
2208
2209
2210
2211
2212
2213

2214
2215
2216
2217
2218
2219
2220
2221
2222

2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250







-
+

+
+
+
+
+
+
+
-
+
+
+
+
+
+


+
+
+
+
+
+
+
+
+
+
+
+
+







 "futures-sink",
 "pin-project-lite 0.2.14",
 "tokio",
]

[[package]]
name = "toml"
version = "0.5.11"
version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335"
dependencies = [
 "serde",
 "serde_spanned",
 "toml_datetime",
 "toml_edit",
]
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"

[[package]]
name = "toml_datetime"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf"
dependencies = [
 "serde",
]

[[package]]
name = "toml_edit"
version = "0.22.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38"
dependencies = [
 "indexmap",
 "serde",
 "serde_spanned",
 "toml_datetime",
 "winnow",
]

[[package]]
name = "tower-service"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
2603
2604
2605
2606
2607
2608
2609









2610
2611
2612
2613
2614
2615
2616
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655







+
+
+
+
+
+
+
+
+







checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"

[[package]]
name = "windows_x86_64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"

[[package]]
name = "winnow"
version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1"
dependencies = [
 "memchr",
]

[[package]]
name = "winreg"
version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
1
2
3
4
5
6
7
8
9
10
11
12
13






14
15
16
17
1
2
3
4
5
6
7






8
9
10
11
12
13
14
15
16
17







-
-
-
-
-
-
+
+
+
+
+
+




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

[dependencies]
anyhow = "*"
async-std = { version = "*", features = [ "tokio1" ] }
config = { version = "*", default-features = false, features = [ "toml" ] }
teloxide = { version = "*", features = [ "rustls", "throttle" ] }
mail-parser = { version = "*", features = ["serde", "serde_support"] }
samotop = { version = "*", default-features = false, features = [ "delivery", "parser-peg" ] }
anyhow = "1.0.86"
async-std = { version = "1.12.0", features = [ "tokio1" ] }
config = { version = "0.14.0", default-features = false, features = [ "toml" ] }
teloxide = { version = "0.12.2", features = [ "rustls", "throttle" ] }
mail-parser = { version = "0.9.3", features = ["serde", "serde_support"] }
samotop = { version = "0.13.2", default-features = false, features = [ "delivery", "parser-peg" ] }

[profile.release]
lto = true
codegen-units = 1
19
20
21
22
23
24
25


26
27
28
29
30
31
32
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34







+
+







	Bot,
	prelude::{
		Requester,
		RequesterExt,
	},
	types::{
		ChatId,
		InputMedia,
		Message,
		ParseMode::MarkdownV2,
	},
};

use std::{
	borrow::Cow,
	collections::{
143
144
145
146
147
148
149
150

151
152
153
154
155
156
157
158
159
145
146
147
148
149
150
151

152


153
154
155
156
157
158
159







-
+
-
-







				.ok_or(anyhow!("Failed to extract text from message."))?;
			if text.len() < 4096 - header_size {
				body = text;
				text_num = 1;
			}
		};
		reply.push("```".into());
		for line in body.lines() {
		reply.extend(body.lines().map(|x| x.into()));
			reply.push(line.into());
		}
		reply.push("```".into());

		// and let's collect all other attachment parts
		let mut files_to_send = vec![];
		/*
		 * let's just skip html parts for now, they just duplicate text?
		while html_num < html_parts {
204
205
206
207
208
209
210
211

212
213
214
215
216
217
218
204
205
206
207
208
209
210

211
212
213
214
215
216
217
218







-
+







						.file_name(filename));
					let item = if first_one {
						first_one = false;
						item.caption(&msg).parse_mode(MarkdownV2)
					} else {
						item
					};
					files.push(teloxide::types::InputMedia::Document(item));
					files.push(InputMedia::Document(item));
				}
				core.sendgroup(chat, files).await?;
			} else {
				core.send(chat, &msg).await?;
			}
		}

248
249
250
251
252
253
254
255

256
257
258
259
260

261
262
263
264
265
266


267
268
269
270
271
272
273
248
249
250
251
252
253
254

255
256
257
258
259

260
261
262
263
264


265
266
267
268
269
270
271
272
273







-
+




-
+




-
-
+
+








		TelegramTransport {
			tg,
			recipients,
		}
	}

	pub async fn debug<'b, S>(&self, msg: S) -> Result<teloxide::types::Message>
	pub async fn debug<'b, S>(&self, msg: S) -> Result<Message>
	where S: Into<String> {
		Ok(self.tg.send_message(*self.recipients.get("_").unwrap(), msg).await?)
	}

	pub async fn send<'b, S>(&self, to: &ChatId, msg: S) -> Result<teloxide::types::Message>
	pub async fn send<'b, S>(&self, to: &ChatId, msg: S) -> Result<Message>
	where S: Into<String> {
		Ok(self.tg.send_message(*to, msg).await?)
	}

	pub async fn sendgroup<M>(&self, to: &ChatId, media: M) -> Result<Vec<teloxide::types::Message>>
	where M: IntoIterator<Item = teloxide::types::InputMedia> {
	pub async fn sendgroup<M>(&self, to: &ChatId, media: M) -> Result<Vec<Message>>
	where M: IntoIterator<Item = InputMedia> {
		Ok(self.tg.send_media_group(*to, media).await?)
	}
}

#[async_std::main]
async fn main() {
	let settings: config::Config = config::Config::builder()