diff --git a/src/error.rs b/src/error.rs index f8ebe6e..8923f4d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -21,7 +21,7 @@ use xmpp_parsers::{FullJid, Jid}; #[derive(Debug)] pub enum Error { - MismatchJids(Jid), + MismatchJids(Jid, Jid), NickAlreadyAssigned(String), NonexistantSession(FullJid), XMPPError(TokioXMPPError), @@ -32,7 +32,7 @@ impl StdError for Error {} impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - Error::MismatchJids(err) => write!(f, "Mismatch Jids: {}", err), + Error::MismatchJids(jid1, jid2) => write!(f, "Mismatch Jids: {}, {}", jid1, jid2), Error::NickAlreadyAssigned(err) => write!(f, "Nickname already assigned: {}", err), Error::NonexistantSession(err) => write!(f, "Session doesn't exist: {}", err), Error::XMPPError(err) => write!(f, "XMPP error: {}", err), diff --git a/src/room.rs b/src/room.rs index 9ad77cb..9b673cb 100644 --- a/src/room.rs +++ b/src/room.rs @@ -221,7 +221,7 @@ impl Occupant { pub fn add_session(&mut self, real: FullJid) -> Result<(), Error> { if BareJid::from(real.clone()) != self.real { - return Err(Error::MismatchJids(Jid::from(real.clone()))); + return Err(Error::MismatchJids(Jid::from(self.real.clone()), Jid::from(real.clone()))); } Ok(()) @@ -229,7 +229,7 @@ impl Occupant { pub fn remove_session(&mut self, real: FullJid) -> Result<(), Error> { if BareJid::from(real.clone()) != self.real { - return Err(Error::MismatchJids(Jid::from(real.clone()))); + return Err(Error::MismatchJids(Jid::from(self.real.clone()), Jid::from(real.clone()))); } let len = self.sessions.len();