Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/imessage/aps_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,14 @@ impl IMClient {
let command = payload.command;
// delivered/read
if let IDSRecvMessage {
command: 101 | 102 | 113,
command: 101 | 102 | 113 | 106,
..
} = &payload {
return Ok(payload.to_message(None, match command {
101 => Message::Delivered,
102 => Message::Read,
113 => Message::NotifyAnyways,
106 => Message::Keep,
_ => panic!("no")
}).ok())
}
Expand Down
10 changes: 9 additions & 1 deletion src/imessage/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,7 @@ pub enum Message {
ShareProfile(ShareProfileMessage),
NotifyAnyways,
SetTranscriptBackground(SetTranscriptBackgroundMessage),
Keep,
}


Expand Down Expand Up @@ -1678,6 +1679,7 @@ impl Message {
Self::ShareProfile(_) => 131,
Self::NotifyAnyways => 113,
Self::SetTranscriptBackground(_) => 138,
Self::Keep => 106,
}
}

Expand Down Expand Up @@ -1752,6 +1754,7 @@ impl Message {
Self::UpdateProfileSharing(_) => Some(true),
Self::NotifyAnyways => Some(true),
Self::SetTranscriptBackground(_) => Some(true),
Self::Keep => Some(true),
_ => None
}
}
Expand Down Expand Up @@ -1837,7 +1840,10 @@ impl fmt::Display for Message {
},
Message::SetTranscriptBackground(_) => {
write!(f, "Changed the transcript background")
}
},
Message::Keep => {
write!(f, "kept a message")
},
}
}
}
Expand Down Expand Up @@ -1943,6 +1949,7 @@ impl MessageInst {
Message::PeerCacheInvalidate => false,
Message::Unschedule => false,
Message::NotifyAnyways => false,
Message::Keep => false,
_ => true
}
}
Expand Down Expand Up @@ -2379,6 +2386,7 @@ impl MessageInst {
},
Message::Delivered => panic!("no enc body!"),
Message::Read => panic!("no enc body!"),
Message::Keep => panic!("no enc body!"),
Message::MessageReadOnDevice => panic!("no enc body!"),
Message::PeerCacheInvalidate => panic!("no enc body!"),
Message::Error(_) => panic!("no enc body!"),
Expand Down
10 changes: 10 additions & 0 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,16 @@ async fn main() {
client.identity.certify_delivery("com.apple.madrid", &context, false).await.unwrap();
}
}
//automatically keep audio messages
if let Message::Message(normal_message) = &msg.message {
if normal_message.voice {
if let Some(conversation_data) = msg.conversation.clone() {
let mut keep_msg = MessageInst::new(conversation_data, &handle, Message::Keep);
keep_msg.id = msg.id.clone();
client.send(&mut keep_msg).await.unwrap();
}
}
}
}
},
input = &mut read_task => {
Expand Down
Loading