Overview
| Comment: | minor typos, add back tests, change formatting a lot |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
c996f5c87175fa5c6c83ad67a20742f6 |
| User & Date: | arcade on 2026-01-12 13:41:17.558 |
| Other Links: | manifest | tags |
Context
|
2026-01-12
| ||
| 14:46 | fix typo, fix comments, drop unneeded constant check-in: 6ce625a569 user: arcade tags: trunk | |
| 13:41 | minor typos, add back tests, change formatting a lot check-in: c996f5c871 user: arcade tags: trunk | |
| 13:39 | add action for pull requests, ass sccache check-in: 4448c56dd2 user: arcade tags: trunk | |
Changes
Modified src/mail.rs
from [bbe46eca75]
to [3793bdb43d].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | - |
use crate::{
Cursor,
telegram::TelegramTransport,
utils::{
Attachment,
RE_DOMAIN,
validate,
},
};
use std::{
|
| ︙ | |||
158 159 160 161 162 163 164 | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | - + - - - - - + - - + + + + - - + - - + |
}
if self.fields.contains("date")
&& let Some(date) = mail.date()
{
reply.push(format!("<u><i>Date:</i></u> <code>{date}</code>"));
}
reply.push("</blockquote><pre>".into());
|
| ︙ | |||
220 221 222 223 224 225 226 | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | - |
}
while file_num < attachments {
files_to_send.push(mail.attachment(file_num.try_into().stack()?)
.context("Failed to get file part from message.")?);
file_num += 1;
}
|
| ︙ |
Modified src/main.rs
from [0f4a847d20]
to [422765bb02].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | + + + |
//! Simple SMTP-to-Telegram gateway. Can parse email and send them as telegram
//! messages to specified chats, generally you specify which email address is
//! available in configuration, everything else is sent to default address.
mod mail;
mod telegram;
mod utils;
#[cfg(test)]
mod tests;
use crate::mail::MailServer;
use async_compat::Compat;
use just_getopt::{
OptFlags,
OptSpecs,
|
| ︙ | |||
48 49 50 51 52 53 54 | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | - + |
let mut args = std::env::args();
args.next();
let parsed = specs.getopt(args);
for u in &parsed.unknown {
println!("Unknown option: {u}");
}
if !(parsed.unknown.is_empty()) || parsed.options_first("help").is_some() {
|
| ︙ |
Modified src/telegram.rs
from [9286def5b5]
to [9de705aadb].
| 1 2 3 4 5 6 7 8 9 10 11 | - + + + + |
|
| ︙ | |||
53 54 55 56 57 58 59 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | - + |
recipients,
default,
})
}
/// Send message to default user, used for debug/log/info purposes
pub async fn debug (&self, msg: &str) -> Result<Message> {
|
| ︙ |
Added src/tests.rs version [4300f88482].
Modified src/utils.rs
from [eb1273e849]
to [448dd04db5].
| ︙ | |||
21 22 23 24 25 26 27 | 21 22 23 24 25 26 27 28 29 30 | - - + |
}
/// Pass any text here to be validated as HTML, breaks on validation errors
pub fn validate (text: &str) -> Result<&str> {
let fragment = Html::parse_fragment(text);
if !fragment.errors.is_empty() {
bail!(fragment.errors.join("\n"));
|