Private
Public Access
1
0

fix all warnings

This commit is contained in:
2025-06-16 19:25:24 -07:00
parent 9d591dffc5
commit 75fe4d4608
8 changed files with 18 additions and 110 deletions

View File

@@ -56,12 +56,6 @@ enum AttachmentStoreError {
APIClientError(String),
}
#[derive(Debug, Clone)]
struct DownloadRequest {
guid: String,
preview: bool,
}
pub struct AttachmentStore {
store_path: PathBuf,
database: Arc<Mutex<Database>>,

View File

@@ -29,7 +29,7 @@ use kordophone_db::{
use kordophone::api::http_client::HTTPAPIClient;
use kordophone::api::APIInterface;
use kordophone::model::outgoing_message::OutgoingMessage;
use kordophone::model::ConversationID;
use kordophone::model::{ConversationID, MessageID};
mod update_monitor;
use update_monitor::{UpdateMonitor, UpdateMonitorCommand};
@@ -57,8 +57,6 @@ pub enum DaemonError {
pub type DaemonResult<T> = Result<T, Box<dyn Error + Send + Sync>>;
type DaemonClient = HTTPAPIClient<DatabaseAuthenticationStore>;
pub mod target {
pub static SYNC: &str = "sync";
pub static EVENT: &str = "event";
@@ -392,14 +390,6 @@ impl Daemon {
self.signal_receiver.take().unwrap()
}
async fn get_conversations(&mut self) -> Vec<Conversation> {
self.database
.lock()
.await
.with_repository(|r| r.all_conversations(i32::MAX, 0).unwrap())
.await
}
async fn get_conversations_limit_offset(
&mut self,
limit: i32,
@@ -415,7 +405,7 @@ impl Daemon {
async fn get_messages(
&mut self,
conversation_id: String,
last_message_id: Option<String>,
_last_message_id: Option<MessageID>,
) -> Vec<Message> {
// Get outgoing messages for this conversation.
let empty_vec: Vec<OutgoingMessage> = vec![];
@@ -601,10 +591,6 @@ impl Daemon {
self.database.with_settings(|s| settings.save(s)).await
}
async fn get_client(&mut self) -> Result<HTTPAPIClient<DatabaseAuthenticationStore>> {
Self::get_client_impl(&mut self.database).await
}
async fn get_client_impl(
database: &mut Arc<Mutex<Database>>,
) -> Result<HTTPAPIClient<DatabaseAuthenticationStore>> {

View File

@@ -73,57 +73,3 @@ impl DbusRegistry {
self.connection.send(message)
}
}
// Keep the old Endpoint struct for backward compatibility during transition
#[derive(Clone)]
pub struct Endpoint<T: Send + Clone + 'static> {
connection: Arc<SyncConnection>,
implementation: T,
}
impl<T: Send + Clone + 'static> Endpoint<T> {
pub fn new(connection: Arc<SyncConnection>, implementation: T) -> Self {
Self {
connection,
implementation,
}
}
pub async fn register_object<F, R>(&self, path: &str, register_fn: F)
where
F: Fn(&mut Crossroads) -> R,
R: IntoIterator<Item = dbus_crossroads::IfaceToken<T>>,
{
let dbus_path = String::from(path);
// Enable async support for the crossroads instance.
// (Currently irrelevant since dbus generates sync code)
let mut cr = Crossroads::new();
cr.set_async_support(Some((
self.connection.clone(),
Box::new(|x| {
tokio::spawn(x);
}),
)));
// Register the daemon as a D-Bus object with multiple interfaces
let tokens: Vec<_> = register_fn(&mut cr).into_iter().collect();
cr.insert(dbus_path, &tokens, self.implementation.clone());
// Start receiving messages.
self.connection.start_receive(
MatchRule::new_method_call(),
Box::new(move |msg, conn| cr.handle_message(msg, conn).is_ok()),
);
info!(target: "dbus", "Registered endpoint at {} with {} interfaces", path, tokens.len());
}
pub fn send_signal<S>(&self, path: &str, signal: S) -> Result<u32, ()>
where
S: dbus::message::SignalArgs + dbus::arg::AppendAll,
{
let message = signal.to_emit_message(&Path::new(path).unwrap());
self.connection.send(message)
}
}