@@ -117,8 +117,11 @@ impl ClusterPresenceMessage {
117117 let status = match self . status . as_str ( ) {
118118 "available" => PresenceStatus :: Available ,
119119 "busy" => PresenceStatus :: Busy ,
120- "away" => PresenceStatus :: Away ,
121- _ => PresenceStatus :: Offline ,
120+ "away" => PresenceStatus :: Away ( String :: new ( ) ) ,
121+ "dnd" => PresenceStatus :: Dnd ,
122+ "offline" => PresenceStatus :: Offline ,
123+ "" => PresenceStatus :: Offline ,
124+ other => PresenceStatus :: Away ( other. to_string ( ) ) ,
122125 } ;
123126 Some ( PresenceState {
124127 status,
@@ -842,7 +845,7 @@ mod tests {
842845 last_updated : 0 ,
843846 } ;
844847 let state = msg. to_state ( ) . unwrap ( ) ;
845- assert_eq ! ( state. status, PresenceStatus :: Away ) ;
848+ assert_eq ! ( state. status, PresenceStatus :: Away ( String :: new ( ) ) ) ;
846849 }
847850
848851 #[ test]
@@ -859,16 +862,16 @@ mod tests {
859862 }
860863
861864 #[ test]
862- fn test_presence_message_to_state_unknown_falls_to_offline ( ) {
865+ fn test_presence_message_to_state_custom_falls_to_away ( ) {
863866 let msg = ClusterPresenceMessage {
864867 identity : "test" . to_string ( ) ,
865- status : "dnd " . to_string ( ) ,
868+ status : "lunch " . to_string ( ) ,
866869 note : None ,
867870 activity : None ,
868871 last_updated : 0 ,
869872 } ;
870873 let state = msg. to_state ( ) . unwrap ( ) ;
871- assert_eq ! ( state. status, PresenceStatus :: Offline ) ;
874+ assert_eq ! ( state. status, PresenceStatus :: Away ( "lunch" . to_string ( ) ) ) ;
872875 }
873876
874877 // ── LocatorEvent → ClusterLocatorMessage conversion ─────────────────────
@@ -1267,7 +1270,7 @@ mod tests {
12671270 #[ test]
12681271 fn test_presence_state_full_round_trip ( ) {
12691272 let original = PresenceState {
1270- status : PresenceStatus :: Away ,
1273+ status : PresenceStatus :: Away ( String :: new ( ) ) ,
12711274 note : Some ( "Lunch" . to_string ( ) ) ,
12721275 activity : Some ( "meal" . to_string ( ) ) ,
12731276 last_updated : 1715000000 ,
@@ -1286,7 +1289,7 @@ mod tests {
12861289 } ;
12871290
12881291 // Assert
1289- assert_eq ! ( reconstructed. status, PresenceStatus :: Away ) ;
1292+ assert_eq ! ( reconstructed. status, PresenceStatus :: Away ( String :: new ( ) ) ) ;
12901293 assert_eq ! ( reconstructed. note. as_deref( ) , Some ( "Lunch" ) ) ;
12911294 assert_eq ! ( reconstructed. activity. as_deref( ) , Some ( "meal" ) ) ;
12921295 assert_eq ! ( reconstructed. last_updated, 1715000000 ) ;
0 commit comments