Add support for reading mail-archive.com RSS feeds

This commit is contained in:
2023-09-20 18:16:30 -07:00
parent 092b29637f
commit dc41aeac14
7 changed files with 1252 additions and 27 deletions

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
use std::{collections::HashMap, fs::File, io::BufReader};
use std::{collections::HashMap, fs::File, io::BufReader, path::PathBuf};
use anyhow::Context;
use matrix_sdk::ruma::{OwnedRoomOrAliasId, OwnedUserId};
@@ -52,7 +52,7 @@ pub struct RepoConfig {
}
#[derive(Deserialize)]
pub struct GitlabConfig {
pub struct GitlabWebhookConfig {
pub url_prefix: Option<String>,
#[serde(default)]
#[serde(deserialize_with = "crate::matrix::deser_optional_room_or_alias_id")]
@@ -62,6 +62,22 @@ pub struct GitlabConfig {
// gitlab.xfce.org/xfce/xfdesktop
}
#[derive(Clone, Deserialize)]
pub struct MailListConfig {
pub name: String,
#[serde(default)]
pub rooms: Vec<OwnedRoomOrAliasId>,
}
#[derive(Deserialize)]
pub struct MailArchiveConfig {
#[serde(default)]
pub default_rooms: Vec<OwnedRoomOrAliasId>,
pub update_interval: u64, // seconds
pub state_dir: PathBuf,
pub lists: Vec<MailListConfig>,
}
#[derive(Deserialize)]
pub struct Config {
pub bind_address: Option<String>,
@@ -69,7 +85,8 @@ pub struct Config {
#[serde(deserialize_with = "crate::matrix::deser_user_id")]
pub user_id: OwnedUserId,
pub password: String,
pub gitlab: GitlabConfig,
pub gitlab_webhook: Option<GitlabWebhookConfig>,
pub mail_archive: Option<MailArchiveConfig>,
}
fn load_blocking(path: &String) -> anyhow::Result<Config> {