diff options
Diffstat (limited to 'filamento')
| -rw-r--r-- | filamento/Cargo.toml | 1 | ||||
| -rw-r--r-- | filamento/examples/example.rs | 23 | ||||
| -rw-r--r-- | filamento/src/caps.rs | 6 | ||||
| -rw-r--r-- | filamento/src/logic/online.rs | 2 | ||||
| -rw-r--r-- | filamento/src/logic/process_stanza.rs | 41 | 
5 files changed, 46 insertions, 27 deletions
diff --git a/filamento/Cargo.toml b/filamento/Cargo.toml index 92c8370..d1749f4 100644 --- a/filamento/Cargo.toml +++ b/filamento/Cargo.toml @@ -20,6 +20,7 @@ sha3 = "0.10.8"  base64 = "0.22.1"  sha1 = "0.10.6"  image = "0.25.6" +hex = "0.4.3"  [dev-dependencies]  tracing-subscriber = "0.3.19" diff --git a/filamento/examples/example.rs b/filamento/examples/example.rs index 8ebfde0..d7c03e4 100644 --- a/filamento/examples/example.rs +++ b/filamento/examples/example.rs @@ -12,21 +12,30 @@ impl FileStore for Files {      type Err = Arc<io::Error>;      async fn is_stored(&self, name: &str) -> Result<bool, Self::Err> { -        Ok(tokio::fs::try_exists(format!("files/{}", name)) +        tracing::debug!("checking if {} is stored", name); +        let res = tokio::fs::try_exists(format!("files/{}", name))              .await -            .map_err(|err| Arc::new(err))?) +            .map_err(|err| Arc::new(err)); +        tracing::debug!("file check res: {:?}", res); +        res      }      async fn store(&self, name: &str, data: &[u8]) -> Result<(), Self::Err> { -        Ok(tokio::fs::write(format!("files/{}", name), data) +        tracing::debug!("storing {} is stored", name); +        let res = tokio::fs::write(format!("files/{}", name), data)              .await -            .map_err(|err| Arc::new(err))?) +            .map_err(|err| Arc::new(err)); +        tracing::debug!("file store res: {:?}", res); +        res      }      async fn delete(&self, name: &str) -> Result<(), Self::Err> { -        Ok(tokio::fs::remove_file(format!("files/{}", name)) +        tracing::debug!("deleting {}", name); +        let res = tokio::fs::remove_file(format!("files/{}", name))              .await -            .map_err(|err| Arc::new(err))?) +            .map_err(|err| Arc::new(err)); +        tracing::debug!("file delete res: {:?}", res); +        res      }  } @@ -37,7 +46,7 @@ async fn main() {          .await          .unwrap();      let (client, mut recv) = Client::new( -        "test@blos.sm".try_into().unwrap(), +        "test@blos.sm/testing2".try_into().unwrap(),          "slayed".to_string(),          db,          Files, diff --git a/filamento/src/caps.rs b/filamento/src/caps.rs index b3464d1..819e669 100644 --- a/filamento/src/caps.rs +++ b/filamento/src/caps.rs @@ -35,13 +35,13 @@ pub fn client_info() -> Info {      Info {          node: None,          features: vec![ -            "http://jabber.org/protocol/disco#items".to_string(), -            "http://jabber.org/protocol/disco#info".to_string(),              "http://jabber.org/protocol/caps".to_string(), -            "http://jabber.org/protocol/nick".to_string(), +            "http://jabber.org/protocol/disco#info".to_string(), +            "http://jabber.org/protocol/disco#items".to_string(),              "http://jabber.org/protocol/nick+notify".to_string(),              "urn:xmpp:avatar:metadata+notify".to_string(),          ], +        // "http://jabber.org/protocol/nick".to_string(),          identities: vec