mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 01:12:24 +00:00
caldav: Implement Dav Push topic
This commit is contained in:
@@ -10,6 +10,7 @@ pub struct Addressbook {
|
||||
pub description: Option<String>,
|
||||
pub deleted_at: Option<NaiveDateTime>,
|
||||
pub synctoken: i64,
|
||||
pub push_topic: String,
|
||||
}
|
||||
|
||||
impl Addressbook {
|
||||
|
||||
@@ -15,6 +15,7 @@ pub struct Calendar {
|
||||
pub deleted_at: Option<NaiveDateTime>,
|
||||
pub synctoken: i64,
|
||||
pub subscription_url: Option<String>,
|
||||
pub push_topic: String,
|
||||
}
|
||||
|
||||
impl Calendar {
|
||||
|
||||
@@ -5,6 +5,7 @@ use crate::{
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use derive_more::derive::Constructor;
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
#[derive(Constructor, Clone)]
|
||||
pub struct ContactBirthdayStore<AS: AddressbookStore + ?Sized>(Arc<AS>);
|
||||
@@ -24,6 +25,12 @@ fn birthday_calendar(addressbook: Addressbook) -> Calendar {
|
||||
deleted_at: addressbook.deleted_at,
|
||||
synctoken: addressbook.synctoken,
|
||||
subscription_url: None,
|
||||
push_topic: {
|
||||
let mut hasher = Sha256::new();
|
||||
hasher.update("birthdays");
|
||||
hasher.update(addressbook.push_topic);
|
||||
format!("{:x}", hasher.finalize())
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user