From 26d0ee51e232b793bc83ba565c0e9ab820d8d0db Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Thu, 17 Apr 2025 11:24:43 +0100 Subject: feat(filamento): remove sqlx --- filamento/src/presence.rs | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) (limited to 'filamento/src/presence.rs') diff --git a/filamento/src/presence.rs b/filamento/src/presence.rs index a7a8965..e406cce 100644 --- a/filamento/src/presence.rs +++ b/filamento/src/presence.rs @@ -1,15 +1,12 @@ use chrono::{DateTime, Utc}; -use sqlx::Sqlite; use stanza::{client::presence::String1024, xep_0203::Delay}; use crate::caps; -#[derive(Debug, Default, sqlx::FromRow, Clone)] +#[derive(Debug, Default, Clone)] pub struct Online { pub show: Option, - #[sqlx(rename = "message")] pub status: Option, - #[sqlx(skip)] pub priority: Option, } @@ -21,42 +18,6 @@ pub enum Show { ExtendedAway, } -impl sqlx::Type for Show { - fn type_info() -> ::TypeInfo { - <&str as sqlx::Type>::type_info() - } -} - -impl sqlx::Decode<'_, Sqlite> for Show { - fn decode( - value: ::ValueRef<'_>, - ) -> Result { - let value = <&str as sqlx::Decode>::decode(value)?; - match value { - "away" => Ok(Self::Away), - "chat" => Ok(Self::Chat), - "do-not-disturb" => Ok(Self::DoNotDisturb), - "extended-away" => Ok(Self::ExtendedAway), - _ => unreachable!(), - } - } -} - -impl sqlx::Encode<'_, Sqlite> for Show { - fn encode_by_ref( - &self, - buf: &mut ::ArgumentBuffer<'_>, - ) -> Result { - let value = match self { - Show::Away => "away", - Show::Chat => "chat", - Show::DoNotDisturb => "do-not-disturb", - Show::ExtendedAway => "extended-away", - }; - <&str as sqlx::Encode>::encode(value, buf) - } -} - #[derive(Debug, Default, Clone)] pub struct Offline { pub status: Option, -- cgit