Commit 3149f79d11
Unregistered key
Layout: unified · split
docs/iamb.1 +2
| @@ -116,6 +116,8 @@ Redact the selected message with the optional reason. | |||
| 116 | Reply to the selected message. | 116 | Reply to the selected message. |
| 117 | .It Sy ":cancel" | 117 | .It Sy ":cancel" |
| 118 | Cancel the currently drafted message including replies. | 118 | Cancel the currently drafted message including replies. |
| 119 | .It Sy ":replied" | ||
| 120 | Go to the message the current message replied to. | ||
| 119 | .It Sy ":upload [path]" | 121 | .It Sy ":upload [path]" |
| 120 | Upload an attachment and send it to the currently selected room. | 122 | Upload an attachment and send it to the currently selected room. |
| 121 | .El | 123 | .El |
src/base.rs +44 −14
| @@ -169,6 +169,9 @@ pub enum MessageAction { | |||
| 169 | /// Reply to a message. | 169 | /// Reply to a message. |
| 170 | Reply, | 170 | Reply, |
| 171 | 171 | ||
| 172 | /// Go to the message the hovered message replied to. | ||
| 173 | Replied, | ||
| 174 | |||
| 172 | /// Unreact to a message. | 175 | /// Unreact to a message. |
| 173 | /// | 176 | /// |
| 174 | /// If no specific Emoji to remove to is specified, then all reactions from the user on the | 177 | /// If no specific Emoji to remove to is specified, then all reactions from the user on the |
| @@ -1503,14 +1506,19 @@ impl SyncInfo { | |||
| 1503 | } | 1506 | } |
| 1504 | } | 1507 | } |
| 1505 | 1508 | ||
| 1506 | bitflags::bitflags! { | 1509 | static MESSAGE_NEED_TTL: u8 = 30; |
| 1507 | /// Load-needs | 1510 | |
| 1508 | #[derive(Debug, Default, PartialEq)] | 1511 | #[derive(Debug, PartialEq)] |
| 1509 | pub struct Need: u32 { | 1512 | /// Load messages until the event is loaded or `ttl` loads are exceeded |
| 1510 | const EMPTY = 0b00000000; | 1513 | pub struct MessageNeed { |
| 1511 | const MESSAGES = 0b00000001; | 1514 | pub event_id: OwnedEventId, |
| 1512 | const MEMBERS = 0b00000010; | 1515 | pub ttl: u8, |
| 1513 | } | 1516 | } |
| 1517 | |||
| 1518 | #[derive(Default, Debug, PartialEq)] | ||
| 1519 | pub struct Need { | ||
| 1520 | pub members: bool, | ||
| 1521 | pub messages: Option<Vec<MessageNeed>>, | ||
| 1514 | } | 1522 | } |
| 1515 | 1523 | ||
| 1516 | /// Things that need loading for different rooms. | 1524 | /// Things that need loading for different rooms. |
| @@ -1520,9 +1528,31 @@ pub struct RoomNeeds { | |||
| 1520 | } | 1528 | } |
| 1521 | 1529 | ||
| 1522 | impl RoomNeeds { | 1530 | impl RoomNeeds { |
| 1523 | /// Mark a room for needing something to be loaded. | 1531 | /// Mark a room for needing to load members. |
| 1524 | pub fn insert(&mut self, room_id: OwnedRoomId, need: Need) { | 1532 | pub fn need_members(&mut self, room_id: OwnedRoomId) { |
| 1525 | self.needs.entry(room_id).or_default().insert(need); | 1533 | self.needs.entry(room_id).or_default().members = true; |
| 1534 | } | ||
| 1535 | |||
| 1536 | /// Mark a room for needing to load messages. | ||
| 1537 | pub fn need_messages(&mut self, room_id: OwnedRoomId) { | ||
| 1538 | self.needs.entry(room_id).or_default().messages.get_or_insert_default(); | ||
| 1539 | } | ||
| 1540 | |||
| 1541 | /// Mark a room for needing to load messages until the given message is loaded or a retry limit | ||
| 1542 | /// is exceeded. | ||
| 1543 | pub fn need_message(&mut self, room_id: OwnedRoomId, event_id: OwnedEventId) { | ||
| 1544 | let messages = &mut self.needs.entry(room_id).or_default().messages.get_or_insert_default(); | ||
| 1545 | |||
| 1546 | messages.push(MessageNeed { event_id, ttl: MESSAGE_NEED_TTL }); | ||
| 1547 | } | ||
| 1548 | |||
| 1549 | pub fn need_messages_all(&mut self, room_id: OwnedRoomId, message_needs: Vec<MessageNeed>) { | ||
| 1550 | self.needs | ||
| 1551 | .entry(room_id) | ||
| 1552 | .or_default() | ||
| 1553 | .messages | ||
| 1554 | .get_or_insert_default() | ||
| 1555 | .extend(message_needs); | ||
| 1526 | } | 1556 | } |
| 1527 | 1557 | ||
| 1528 | pub fn rooms(&self) -> usize { | 1558 | pub fn rooms(&self) -> usize { |
| @@ -2300,12 +2330,12 @@ pub mod tests { | |||
| 2300 | 2330 | ||
| 2301 | let mut need_load = RoomNeeds::default(); | 2331 | let mut need_load = RoomNeeds::default(); |
| 2302 | 2332 | ||
| 2303 | need_load.insert(room_id.clone(), Need::MESSAGES); | 2333 | need_load.need_messages(room_id.clone()); |
| 2304 | need_load.insert(room_id.clone(), Need::MEMBERS); | 2334 | need_load.need_members(room_id.clone()); |
| 2305 | 2335 | ||
| 2306 | assert_eq!(need_load.into_iter().collect::<Vec<(OwnedRoomId, Need)>>(), vec![( | 2336 | assert_eq!(need_load.into_iter().collect::<Vec<(OwnedRoomId, Need)>>(), vec![( |
| 2307 | room_id, | 2337 | room_id, |
| 2308 | Need::MESSAGES | Need::MEMBERS, | 2338 | Need { members: true, messages: Some(Vec::new()) } |
| 2309 | )],); | 2339 | )],); |
| 2310 | } | 2340 | } |
| 2311 | 2341 | ||
src/commands.rs +16
| @@ -286,6 +286,17 @@ fn iamb_reply(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult { | |||
| 286 | return Ok(step); | 286 | return Ok(step); |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | fn iamb_replied(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult { | ||
| 290 | if !desc.arg.text.is_empty() { | ||
| 291 | return Result::Err(CommandError::InvalidArgument); | ||
| 292 | } | ||
| 293 | |||
| 294 | let ract = IambAction::from(MessageAction::Replied); | ||
| 295 | let step = CommandStep::Continue(ract.into(), ctx.context.clone()); | ||
| 296 | |||
| 297 | return Ok(step); | ||
| 298 | } | ||
| 299 | |||
| 289 | fn iamb_editor(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult { | 300 | fn iamb_editor(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult { |
| 290 | if !desc.arg.text.is_empty() { | 301 | if !desc.arg.text.is_empty() { |
| 291 | return Result::Err(CommandError::InvalidArgument); | 302 | return Result::Err(CommandError::InvalidArgument); |
| @@ -767,6 +778,11 @@ fn add_iamb_commands(cmds: &mut ProgramCommands) { | |||
| 767 | aliases: vec![], | 778 | aliases: vec![], |
| 768 | f: iamb_reply, | 779 | f: iamb_reply, |
| 769 | }); | 780 | }); |
| 781 | cmds.add_command(ProgramCommand { | ||
| 782 | name: "replied".into(), | ||
| 783 | aliases: vec![], | ||
| 784 | f: iamb_replied, | ||
| 785 | }); | ||
| 770 | cmds.add_command(ProgramCommand { | 786 | cmds.add_command(ProgramCommand { |
| 771 | name: "rooms".into(), | 787 | name: "rooms".into(), |
| 772 | aliases: vec![], | 788 | aliases: vec![], |
src/windows/mod.rs +2 −3
| @@ -66,7 +66,6 @@ use crate::base::{ | |||
| 66 | IambInfo, | 66 | IambInfo, |
| 67 | IambResult, | 67 | IambResult, |
| 68 | MessageAction, | 68 | MessageAction, |
| 69 | Need, | ||
| 70 | ProgramAction, | 69 | ProgramAction, |
| 71 | ProgramContext, | 70 | ProgramContext, |
| 72 | ProgramStore, | 71 | ProgramStore, |
| @@ -801,7 +800,7 @@ impl Window<IambInfo> for IambWindow { | |||
| 801 | let (room, name, tags) = store.application.worker.get_room(room_id)?; | 800 | let (room, name, tags) = store.application.worker.get_room(room_id)?; |
| 802 | let room = RoomState::new(room, thread, name, tags, store); | 801 | let room = RoomState::new(room, thread, name, tags, store); |
| 803 | 802 | ||
| 804 | store.application.need_load.insert(room.id().to_owned(), Need::MEMBERS); | 803 | store.application.need_load.need_members(room.id().to_owned()); |
| 805 | return Ok(room.into()); | 804 | return Ok(room.into()); |
| 806 | }, | 805 | }, |
| 807 | IambId::DirectList => { | 806 | IambId::DirectList => { |
| @@ -863,7 +862,7 @@ impl Window<IambInfo> for IambWindow { | |||
| 863 | let (room, name, tags) = store.application.worker.get_room(room_id)?; | 862 | let (room, name, tags) = store.application.worker.get_room(room_id)?; |
| 864 | let room = RoomState::new(room, None, name, tags, store); | 863 | let room = RoomState::new(room, None, name, tags, store); |
| 865 | 864 | ||
| 866 | store.application.need_load.insert(room.id().to_owned(), Need::MEMBERS); | 865 | store.application.need_load.need_members(room.id().to_owned()); |
| 867 | Ok(room.into()) | 866 | Ok(room.into()) |
| 868 | } | 867 | } |
| 869 | } | 868 | } |
src/windows/room/chat.rs +15
| @@ -450,6 +450,21 @@ impl ChatState { | |||
| 450 | 450 | ||
| 451 | Ok(None) | 451 | Ok(None) |
| 452 | }, | 452 | }, |
| 453 | MessageAction::Replied => { | ||
| 454 | let Some(reply) = msg.reply_to() else { | ||
| 455 | let msg = "Selected message is not a reply"; | ||
| 456 | return Err(UIError::Failure(msg.into())); | ||
| 457 | }; | ||
| 458 | |||
| 459 | let Some(key) = info.get_message_key(&reply) else { | ||
| 460 | store.application.need_load.need_message(self.room_id.clone(), reply); | ||
| 461 | let msg = "Replied to message will be loaded in the background"; | ||
| 462 | return Err(UIError::Failure(msg.into())); | ||
| 463 | }; | ||
| 464 | |||
| 465 | self.scrollback.goto_message(key.clone()); | ||
| 466 | Ok(None) | ||
| 467 | }, | ||
| 453 | MessageAction::Unreact(reaction, literal) => { | 468 | MessageAction::Unreact(reaction, literal) => { |
| 454 | let emoji = match reaction { | 469 | let emoji = match reaction { |
| 455 | reaction if literal => reaction, | 470 | reaction if literal => reaction, |
src/windows/room/scrollback.rs +12 −19
| @@ -47,7 +47,6 @@ use crate::{ | |||
| 47 | IambId, | 47 | IambId, |
| 48 | IambInfo, | 48 | IambInfo, |
| 49 | IambResult, | 49 | IambResult, |
| 50 | Need, | ||
| 51 | ProgramContext, | 50 | ProgramContext, |
| 52 | ProgramStore, | 51 | ProgramStore, |
| 53 | RoomFetchStatus, | 52 | RoomFetchStatus, |
| @@ -165,6 +164,12 @@ impl ScrollbackState { | |||
| 165 | self.cursor = MessageCursor::latest(); | 164 | self.cursor = MessageCursor::latest(); |
| 166 | } | 165 | } |
| 167 | 166 | ||
| 167 | pub fn goto_message(&mut self, target: MessageKey) { | ||
| 168 | let mut cursor = MessageCursor::new(target, 0); | ||
| 169 | std::mem::swap(&mut cursor, &mut self.cursor); | ||
| 170 | self.jumped.push(cursor); | ||
| 171 | } | ||
| 172 | |||
| 168 | /// Set the dimensions and placement within the terminal window for this list. | 173 | /// Set the dimensions and placement within the terminal window for this list. |
| 169 | pub fn set_term_info(&mut self, area: Rect) { | 174 | pub fn set_term_info(&mut self, area: Rect) { |
| 170 | self.viewctx.dimensions = (area.width as usize, area.height as usize); | 175 | self.viewctx.dimensions = (area.width as usize, area.height as usize); |
| @@ -689,10 +694,7 @@ impl EditorActions<ProgramContext, ProgramStore, IambInfo> for ScrollbackState { | |||
| 689 | 694 | ||
| 690 | let (mc, needs_load) = self.find_message(key, dir, &needle, count, info); | 695 | let (mc, needs_load) = self.find_message(key, dir, &needle, count, info); |
| 691 | if needs_load { | 696 | if needs_load { |
| 692 | store | 697 | store.application.need_load.need_messages(self.room_id.clone()); |
| 693 | .application | ||
| 694 | .need_load | ||
| 695 | .insert(self.room_id.clone(), Need::MESSAGES); | ||
| 696 | } | 698 | } |
| 697 | mc | 699 | mc |
| 698 | }, | 700 | }, |
| @@ -768,10 +770,7 @@ impl EditorActions<ProgramContext, ProgramStore, IambInfo> for ScrollbackState { | |||
| 768 | 770 | ||
| 769 | let (mc, needs_load) = self.find_message(key, dir, &needle, count, info); | 771 | let (mc, needs_load) = self.find_message(key, dir, &needle, count, info); |
| 770 | if needs_load { | 772 | if needs_load { |
| 771 | store | 773 | store.application.need_load.need_messages(self.room_id.to_owned()); |
| 772 | .application | ||
| 773 | .need_load | ||
| 774 | .insert(self.room_id.to_owned(), Need::MESSAGES); | ||
| 775 | } | 774 | } |
| 776 | 775 | ||
| 777 | mc.map(|c| self._range_to(c)) | 776 | mc.map(|c| self._range_to(c)) |
| @@ -1328,10 +1327,7 @@ impl StatefulWidget for Scrollback<'_> { | |||
| 1328 | k | 1327 | k |
| 1329 | } else { | 1328 | } else { |
| 1330 | if state.need_more_messages(info) { | 1329 | if state.need_more_messages(info) { |
| 1331 | self.store | 1330 | self.store.application.need_load.need_messages(state.room_id.to_owned()); |
| 1332 | .application | ||
| 1333 | .need_load | ||
| 1334 | .insert(state.room_id.to_owned(), Need::MESSAGES); | ||
| 1335 | } | 1331 | } |
| 1336 | return; | 1332 | return; |
| 1337 | }; | 1333 | }; |
| @@ -1435,10 +1431,7 @@ impl StatefulWidget for Scrollback<'_> { | |||
| 1435 | // Check whether we should load older messages for this room. | 1431 | // Check whether we should load older messages for this room. |
| 1436 | if state.need_more_messages(info) { | 1432 | if state.need_more_messages(info) { |
| 1437 | // If the top of the screen is the older message, load more. | 1433 | // If the top of the screen is the older message, load more. |
| 1438 | self.store | 1434 | self.store.application.need_load.need_messages(state.room_id.to_owned()); |
| 1439 | .application | ||
| 1440 | .need_load | ||
| 1441 | .insert(state.room_id.to_owned(), Need::MESSAGES); | ||
| 1442 | } | 1435 | } |
| 1443 | 1436 | ||
| 1444 | info.draw_last = self.store.application.draw_curr; | 1437 | info.draw_last = self.store.application.draw_curr; |
| @@ -1448,7 +1441,7 @@ impl StatefulWidget for Scrollback<'_> { | |||
| 1448 | #[cfg(test)] | 1441 | #[cfg(test)] |
| 1449 | mod tests { | 1442 | mod tests { |
| 1450 | use super::*; | 1443 | use super::*; |
| 1451 | use crate::tests::*; | 1444 | use crate::{base::Need, tests::*}; |
| 1452 | 1445 | ||
| 1453 | #[tokio::test] | 1446 | #[tokio::test] |
| 1454 | async fn test_search_messages() { | 1447 | async fn test_search_messages() { |
| @@ -1493,7 +1486,7 @@ mod tests { | |||
| 1493 | std::mem::take(&mut store.application.need_load) | 1486 | std::mem::take(&mut store.application.need_load) |
| 1494 | .into_iter() | 1487 | .into_iter() |
| 1495 | .collect::<Vec<(OwnedRoomId, Need)>>(), | 1488 | .collect::<Vec<(OwnedRoomId, Need)>>(), |
| 1496 | vec![(room_id.clone(), Need::MESSAGES)] | 1489 | vec![(room_id.clone(), Need { messages: Some(Vec::new()), members: false })] |
| 1497 | ); | 1490 | ); |
| 1498 | 1491 | ||
| 1499 | // Search forward twice to MSG1. | 1492 | // Search forward twice to MSG1. |
src/worker.rs +25 −16
| @@ -88,7 +88,7 @@ use matrix_sdk::{ | |||
| 88 | use modalkit::errors::UIError; | 88 | use modalkit::errors::UIError; |
| 89 | use modalkit::prelude::{EditInfo, InfoMessage}; | 89 | use modalkit::prelude::{EditInfo, InfoMessage}; |
| 90 | 90 | ||
| 91 | use crate::base::Need; | 91 | use crate::base::MessageNeed; |
| 92 | use crate::notifications::register_notifications; | 92 | use crate::notifications::register_notifications; |
| 93 | use crate::{ | 93 | use crate::{ |
| 94 | base::{ | 94 | base::{ |
| @@ -216,7 +216,7 @@ async fn update_event_receipts(info: &mut RoomInfo, room: &MatrixRoom, event_id: | |||
| 216 | 216 | ||
| 217 | #[derive(Debug)] | 217 | #[derive(Debug)] |
| 218 | enum Plan { | 218 | enum Plan { |
| 219 | Messages(OwnedRoomId, Option<String>), | 219 | Messages(OwnedRoomId, Option<String>, Vec<MessageNeed>), |
| 220 | Members(OwnedRoomId), | 220 | Members(OwnedRoomId), |
| 221 | } | 221 | } |
| 222 | 222 | ||
| @@ -225,8 +225,8 @@ async fn load_plans(store: &AsyncProgramStore) -> Vec<Plan> { | |||
| 225 | let ChatStore { need_load, rooms, .. } = &mut locked.application; | 225 | let ChatStore { need_load, rooms, .. } = &mut locked.application; |
| 226 | let mut plan = Vec::with_capacity(need_load.rooms() * 2); | 226 | let mut plan = Vec::with_capacity(need_load.rooms() * 2); |
| 227 | 227 | ||
| 228 | for (room_id, mut need) in std::mem::take(need_load).into_iter() { | 228 | for (room_id, need) in std::mem::take(need_load).into_iter() { |
| 229 | if need.contains(Need::MESSAGES) { | 229 | if let Some(message_need) = need.messages { |
| 230 | let info = rooms.get_or_default(room_id.clone()); | 230 | let info = rooms.get_or_default(room_id.clone()); |
| 231 | 231 | ||
| 232 | if !info.recently_fetched() && !info.fetching { | 232 | if !info.recently_fetched() && !info.fetching { |
| @@ -239,16 +239,11 @@ async fn load_plans(store: &AsyncProgramStore) -> Vec<Plan> { | |||
| 239 | RoomFetchStatus::NotStarted => None, | 239 | RoomFetchStatus::NotStarted => None, |
| 240 | }; | 240 | }; |
| 241 | 241 | ||
| 242 | plan.push(Plan::Messages(room_id.to_owned(), fetch_id)); | 242 | plan.push(Plan::Messages(room_id.to_owned(), fetch_id, message_need)); |
| 243 | need.remove(Need::MESSAGES); | ||
| 244 | } | 243 | } |
| 245 | } | 244 | } |
| 246 | if need.contains(Need::MEMBERS) { | 245 | if need.members { |
| 247 | plan.push(Plan::Members(room_id.to_owned())); | 246 | plan.push(Plan::Members(room_id.to_owned())); |
| 248 | need.remove(Need::MEMBERS); | ||
| 249 | } | ||
| 250 | if !need.is_empty() { | ||
| 251 | need_load.insert(room_id, need); | ||
| 252 | } | 247 | } |
| 253 | } | 248 | } |
| 254 | 249 | ||
| @@ -258,14 +253,14 @@ async fn load_plans(store: &AsyncProgramStore) -> Vec<Plan> { | |||
| 258 | async fn run_plan(client: &Client, store: &AsyncProgramStore, plan: Plan, permits: &Semaphore) { | 253 | async fn run_plan(client: &Client, store: &AsyncProgramStore, plan: Plan, permits: &Semaphore) { |
| 259 | let permit = permits.acquire().await; | 254 | let permit = permits.acquire().await; |
| 260 | match plan { | 255 | match plan { |
| 261 | Plan::Messages(room_id, fetch_id) => { | 256 | Plan::Messages(room_id, fetch_id, message_need) => { |
| 262 | let limit = MIN_MSG_LOAD; | 257 | let limit = MIN_MSG_LOAD; |
| 263 | let client = client.clone(); | 258 | let client = client.clone(); |
| 264 | let store_clone = store.clone(); | 259 | let store_clone = store.clone(); |
| 265 | 260 | ||
| 266 | let res = load_older_one(&client, &room_id, fetch_id, limit).await; | 261 | let res = load_older_one(&client, &room_id, fetch_id, limit).await; |
| 267 | let mut locked = store.lock().await; | 262 | let mut locked = store.lock().await; |
| 268 | load_insert(room_id, res, locked.deref_mut(), store_clone); | 263 | load_insert(room_id, res, locked.deref_mut(), store_clone, message_need); |
| 269 | }, | 264 | }, |
| 270 | Plan::Members(room_id) => { | 265 | Plan::Members(room_id) => { |
| 271 | let res = members_load(client, &room_id).await; | 266 | let res = members_load(client, &room_id).await; |
| @@ -328,6 +323,7 @@ fn load_insert( | |||
| 328 | res: MessageFetchResult, | 323 | res: MessageFetchResult, |
| 329 | locked: &mut ProgramStore, | 324 | locked: &mut ProgramStore, |
| 330 | store: AsyncProgramStore, | 325 | store: AsyncProgramStore, |
| 326 | message_needs: Vec<MessageNeed>, | ||
| 331 | ) { | 327 | ) { |
| 332 | let ChatStore { presences, rooms, worker, picker, settings, .. } = &mut locked.application; | 328 | let ChatStore { presences, rooms, worker, picker, settings, .. } = &mut locked.application; |
| 333 | let info = rooms.get_or_default(room_id.clone()); | 329 | let info = rooms.get_or_default(room_id.clone()); |
| @@ -373,12 +369,25 @@ fn load_insert( | |||
| 373 | } | 369 | } |
| 374 | 370 | ||
| 375 | info.fetch_id = fetch_id.map_or(RoomFetchStatus::Done, RoomFetchStatus::HaveMore); | 371 | info.fetch_id = fetch_id.map_or(RoomFetchStatus::Done, RoomFetchStatus::HaveMore); |
| 372 | |||
| 373 | // check if more are needed | ||
| 374 | let needs: Vec<_> = message_needs | ||
| 375 | .into_iter() | ||
| 376 | .filter(|need| !info.keys.contains_key(&need.event_id) && need.ttl > 0) | ||
| 377 | .map(|mut need| { | ||
| 378 | need.ttl -= 1; | ||
| 379 | need | ||
| 380 | }) | ||
| 381 | .collect(); | ||
| 382 | if !needs.is_empty() { | ||
| 383 | locked.application.need_load.need_messages_all(room_id, needs); | ||
| 384 | } | ||
| 376 | }, | 385 | }, |
| 377 | Err(e) => { | 386 | Err(e) => { |
| 378 | warn!(room_id = room_id.as_str(), err = e.to_string(), "Failed to load older messages"); | 387 | warn!(room_id = room_id.as_str(), err = e.to_string(), "Failed to load older messages"); |
| 379 | 388 | ||
| 380 | // Wait and try again. | 389 | // Wait and try again. |
| 381 | locked.application.need_load.insert(room_id, Need::MESSAGES); | 390 | locked.application.need_load.need_messages_all(room_id, message_needs); |
| 382 | }, | 391 | }, |
| 383 | } | 392 | } |
| 384 | } | 393 | } |
| @@ -573,12 +582,12 @@ pub async fn do_first_sync(client: &Client, store: &AsyncProgramStore) -> Result | |||
| 573 | 582 | ||
| 574 | for room in sync_info.rooms.iter() { | 583 | for room in sync_info.rooms.iter() { |
| 575 | let room_id = room.as_ref().0.room_id().to_owned(); | 584 | let room_id = room.as_ref().0.room_id().to_owned(); |
| 576 | need_load.insert(room_id, Need::MESSAGES); | 585 | need_load.need_messages(room_id); |
| 577 | } | 586 | } |
| 578 | 587 | ||
| 579 | for room in sync_info.dms.iter() { | 588 | for room in sync_info.dms.iter() { |
| 580 | let room_id = room.as_ref().0.room_id().to_owned(); | 589 | let room_id = room.as_ref().0.room_id().to_owned(); |
| 581 | need_load.insert(room_id, Need::MESSAGES); | 590 | need_load.need_messages(room_id); |
| 582 | } | 591 | } |
| 583 | 592 | ||
| 584 | Ok(()) | 593 | Ok(()) |