Overview
| Comment: | regex in get_id was defunct, fix regex, fix logic to filter unknown domains |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
f748e99b701a463ac31bcb5d51c29756 |
| User & Date: | arcade on 2026-08-01 10:24:03.733 |
| Other Links: | manifest | tags |
Context
|
2026-08-01
| ||
| 10:46 | expand README check-in: 880ce86a7f user: arcade tags: trunk | |
| 10:24 | regex in get_id was defunct, fix regex, fix logic to filter unknown domains check-in: f748e99b70 user: arcade tags: trunk | |
| 09:06 | remove lazy_static check-in: 997fb1cff4 user: arcade tags: trunk | |
Changes
Modified src/mail.rs
from [b0961d9144]
to [42331fb6be].
| ︙ | |||
82 83 84 85 86 87 88 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | - + |
domains.insert(domain);
} else {
panic!("[smtp2tg.toml] can't check of domains in \"domains\": {domain}");
}
}
let domains = domains.into_iter().map(|s| escape(&s))
.collect::<Vec<String>>().join("|");
|
| ︙ | |||
104 105 106 107 108 109 110 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | - + - - - - + - - - - - - + + + + + + | tg, fields, address, }) } /// Returns id for provided email address |
| ︙ |
Modified tests/mail.rs
from [5610b717c8]
to [32cfc4300b].
| ︙ | |||
35 36 37 38 39 40 41 42 43 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | + + + + + + |
("someone", 0),
("root", -1),
("unknown@example.com", 0),
];
for (email, id) in cases {
assert_eq!(*server.get_id(email)?, ChatPeerId::from(id), "email [{email}] expected to return id [{id}]");
}
let cases = [
"someone@otherdomain.net",
];
for email in cases {
assert!(server.get_id(email).unwrap_err().to_string().contains("Doesn't look like address from one of our domains."), "email [{email}] expected to fail");
}
Ok(())
}
|