From 22292c86ccecd9948062c927511da2aadb209571 Mon Sep 17 00:00:00 2001 From: pep Date: Thu, 15 Jan 2026 13:19:34 +0100 Subject: [PATCH] xmpp: Replace unimplemented! and panic! with info! calls It's great for debugging for fast-paced implementations but the codebase has been more or less the same for years now (in a state we don't exactly like, but it is what it is) and this is hindering things more than helping. Keep it at the INFO level nonetheless to make it more or less obvious these things are not implemented. Signed-off-by: pep --- xmpp/ChangeLog | 2 ++ xmpp/src/disco/mod.rs | 2 +- xmpp/src/iq/result.rs | 4 ++-- xmpp/src/presence/receive.rs | 5 ++++- xmpp/src/pubsub/mod.rs | 8 ++++---- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/xmpp/ChangeLog b/xmpp/ChangeLog index d949673e..d7942669 100644 --- a/xmpp/ChangeLog +++ b/xmpp/ChangeLog @@ -28,6 +28,8 @@ XXXX-YY-ZZ [ RELEASER ] Please refer to the crate docs for details. (!581) - Allow joining an already joined room with `Agent::join_room` to enable resyncs. Adds a parameter to `muc::room::JoinRoomSettings`. + * Changed: + - Replaced unimplemented! with info! calls. * Added: - Agent::send_room_message takes RoomMessageSettings argument (!483) - Agent::send_raw_message takes RawMessageSettings for any message type (!487) diff --git a/xmpp/src/disco/mod.rs b/xmpp/src/disco/mod.rs index 28f69b94..75cf555a 100644 --- a/xmpp/src/disco/mod.rs +++ b/xmpp/src/disco/mod.rs @@ -48,6 +48,6 @@ pub async fn handle_disco_info_result(agent: &mut Agent, disco: DiscoInfoResult, let _ = agent.client.send_stanza(iq).await; } } else { - unimplemented!("Ignored disco#info response from {}", from); + info!("Ignored disco#info response from {}", from); } } diff --git a/xmpp/src/iq/result.rs b/xmpp/src/iq/result.rs index af00d2d0..3ddb5300 100644 --- a/xmpp/src/iq/result.rs +++ b/xmpp/src/iq/result.rs @@ -49,7 +49,7 @@ pub async fn handle_iq_result( } } Err(e) => { - panic!("Wrong XEP-0048 v1.0 Bookmark format: {}", e); + info!("Wrong XEP-0048 v1.0 Bookmark format: {}", e); } } } else if payload.is("query", ns::DISCO_INFO) { @@ -58,7 +58,7 @@ pub async fn handle_iq_result( disco::handle_disco_info_result(agent, disco, from).await; } Err(e) => match e { - _ => panic!("Wrong disco#info format: {}", e), + _ => info!("Wrong disco#info format: {}", e), }, } } diff --git a/xmpp/src/presence/receive.rs b/xmpp/src/presence/receive.rs index 5b182f04..60ceb413 100644 --- a/xmpp/src/presence/receive.rs +++ b/xmpp/src/presence/receive.rs @@ -58,7 +58,10 @@ pub async fn handle_presence(agent: &mut Agent, presence: Presence) -> Vec unimplemented!("Presence type {:?}", presence.type_), // TODO: What to do here? + _ => debug!( + "Unhandled self-presence with type {:?} from {:?}", + presence.type_, from + ), } } } diff --git a/xmpp/src/pubsub/mod.rs b/xmpp/src/pubsub/mod.rs index 1adc61e3..3b504d1b 100644 --- a/xmpp/src/pubsub/mod.rs +++ b/xmpp/src/pubsub/mod.rs @@ -86,7 +86,7 @@ pub(crate) async fn handle_event( error!("No published or retracted item in pubsub event!"); } } - ref node => unimplemented!("node {}", node), + ref node => info!("Unhandled PubSub node {}", node), } } Ok(pubsub::Event { @@ -95,12 +95,12 @@ pub(crate) async fn handle_event( ref node if node == ns::BOOKMARKS2 => { warn!("The bookmarks2 PEP node was deleted!"); } - ref node => unimplemented!("node {}", node), + ref node => info!("Unhandled PubSub node {}", node), }, Err(e) => { error!("Error parsing PubSub event: {}", e); } - _ => unimplemented!("PubSub event: {:#?}", event), + _ => info!("Unhandled PubSub event: {:#?}", event), } events } @@ -176,7 +176,7 @@ pub(crate) async fn handle_iq_result( } } } - _ => unimplemented!(), + ref node => info!("Unhandled PubSub node: {}", node), } } events