@@ -2445,7 +2445,7 @@ async fn notifs() -> Result<bool, String> {
24452445 match process_rumor ( rumor_event, rumor_context) . await {
24462446 Ok ( result) => {
24472447 match result {
2448- RumorProcessingResult :: TextMessage ( message) => {
2448+ RumorProcessingResult :: TextMessage ( message) | RumorProcessingResult :: FileAttachment ( message ) => {
24492449 // Add to unified storage
24502450 let was_added = {
24512451 let mut state = crate :: STATE . lock ( ) . await ;
@@ -2458,11 +2458,50 @@ async fn notifs() -> Result<bool, String> {
24582458 None
24592459 }
24602460 }
2461- _ => None ,
2461+ RumorProcessingResult :: Reaction ( reaction) => {
2462+ // Handle reactions in real-time
2463+ let was_added = {
2464+ let mut state = crate :: STATE . lock ( ) . await ;
2465+ if let Some ( ( chat_id, msg) ) = state. find_chat_and_message_mut ( & reaction. reference_id ) {
2466+ msg. add_reaction ( reaction. clone ( ) , Some ( chat_id) )
2467+ } else {
2468+ false
2469+ }
2470+ } ;
2471+
2472+ if was_added {
2473+ println ! ( "[MLS][live] Reaction added: {}" , reaction. reference_id) ;
2474+ }
2475+ None // Don't emit as message
2476+ }
2477+ RumorProcessingResult :: TypingIndicator { profile_id, until } => {
2478+ // Handle typing indicators in real-time
2479+ let active_typers = {
2480+ let mut state = crate :: STATE . lock ( ) . await ;
2481+ if let Some ( chat) = state. get_chat_mut ( & group_id_for_persist) {
2482+ chat. update_typing_participant ( profile_id. clone ( ) , until) ;
2483+ chat. get_active_typers ( )
2484+ } else {
2485+ Vec :: new ( )
2486+ }
2487+ } ;
2488+
2489+ // Emit typing update event
2490+ if let Some ( handle) = TAURI_APP . get ( ) {
2491+ let _ = handle. emit ( "typing-update" , serde_json:: json!( {
2492+ "chat_id" : group_id_for_persist,
2493+ "active_typers" : active_typers
2494+ } ) ) ;
2495+ }
2496+
2497+ println ! ( "[MLS][live] Typing indicator processed for group: {}" , group_id_for_persist) ;
2498+ None // Don't emit as message
2499+ }
2500+ RumorProcessingResult :: Ignored => None ,
24622501 }
24632502 }
24642503 Err ( e) => {
2465- eprintln ! ( "[MLS] Failed to process rumor: {}" , e) ;
2504+ eprintln ! ( "[MLS][live] Failed to process rumor: {}" , e) ;
24662505 None
24672506 }
24682507 }
@@ -2798,8 +2837,13 @@ async fn generate_blurhash_preview(npub: String, msg_id: String) -> Result<Strin
27982837 let mut found_attachment = None ;
27992838
28002839 for chat in & state. chats {
2801- // Check if this chat involves the specified profile
2802- if chat. has_participant ( & npub) {
2840+ // Check if this is the target chat (works for both DMs and group chats)
2841+ let is_target_chat = match & chat. chat_type {
2842+ ChatType :: MlsGroup => chat. id == npub,
2843+ ChatType :: DirectMessage => chat. has_participant ( & npub) ,
2844+ } ;
2845+
2846+ if is_target_chat {
28032847 // Look for the message in this chat
28042848 if let Some ( message) = chat. messages . iter ( ) . find ( |m| m. id == msg_id) {
28052849 // Get the first attachment
@@ -2834,7 +2878,13 @@ async fn download_attachment(npub: String, msg_id: String, attachment_id: String
28342878 // Find the message and attachment in chats
28352879 let mut found_attachment = None ;
28362880 for chat in & mut state. chats {
2837- if chat. has_participant ( & npub) {
2881+ // For group chats, npub is the group_id; for DMs, it's a participant npub
2882+ let is_target_chat = match & chat. chat_type {
2883+ ChatType :: MlsGroup => chat. id == npub,
2884+ ChatType :: DirectMessage => chat. has_participant ( & npub) ,
2885+ } ;
2886+
2887+ if is_target_chat {
28382888 if let Some ( message) = chat. messages . iter_mut ( ) . find ( |m| m. id == msg_id) {
28392889 if let Some ( attachment) = message. attachments . iter_mut ( ) . find ( |a| a. id == attachment_id) {
28402890 // Check that we're not already downloading
@@ -2875,7 +2925,12 @@ async fn download_attachment(npub: String, msg_id: String, attachment_id: String
28752925
28762926 // Find and update the attachment status
28772927 for chat in & mut state. chats {
2878- if chat. has_participant ( & npub) {
2928+ let is_target_chat = match & chat. chat_type {
2929+ ChatType :: MlsGroup => chat. id == npub,
2930+ ChatType :: DirectMessage => chat. has_participant ( & npub) ,
2931+ } ;
2932+
2933+ if is_target_chat {
28792934 if let Some ( message) = chat. messages . iter_mut ( ) . find ( |m| m. id == msg_id) {
28802935 if let Some ( attachment) = message. attachments . iter_mut ( ) . find ( |a| a. id == attachment_id) {
28812936 attachment. downloading = false ;
@@ -2909,7 +2964,12 @@ async fn download_attachment(npub: String, msg_id: String, attachment_id: String
29092964
29102965 // Find and update the attachment status
29112966 for chat in & mut state. chats {
2912- if chat. has_participant ( & npub) {
2967+ let is_target_chat = match & chat. chat_type {
2968+ ChatType :: MlsGroup => chat. id == npub,
2969+ ChatType :: DirectMessage => chat. has_participant ( & npub) ,
2970+ } ;
2971+
2972+ if is_target_chat {
29132973 if let Some ( message) = chat. messages . iter_mut ( ) . find ( |m| m. id == msg_id) {
29142974 if let Some ( attachment) = message. attachments . iter_mut ( ) . find ( |a| a. id == attachment_id) {
29152975 attachment. downloading = false ;
@@ -2944,7 +3004,12 @@ async fn download_attachment(npub: String, msg_id: String, attachment_id: String
29443004
29453005 // Find and update the attachment
29463006 for chat in & mut state. chats {
2947- if chat. has_participant ( & npub) {
3007+ let is_target_chat = match & chat. chat_type {
3008+ ChatType :: MlsGroup => chat. id == npub,
3009+ ChatType :: DirectMessage => chat. has_participant ( & npub) ,
3010+ } ;
3011+
3012+ if is_target_chat {
29483013 if let Some ( message) = chat. messages . iter_mut ( ) . find ( |m| m. id == msg_id) {
29493014 if let Some ( attachment_index) = message. attachments . iter ( ) . position ( |a| a. id == attachment_id) {
29503015 let attachment = & mut message. attachments [ attachment_index] ;
@@ -4937,6 +5002,7 @@ pub fn run() {
49375002 message:: voice_message,
49385003 message:: file_message,
49395004 message:: react,
5005+ message:: react_to_message,
49405006 message:: fetch_msg_metadata,
49415007 fetch_messages,
49425008 warmup_nip96_servers,
0 commit comments