notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

thread.rs (683B)


      1 use crate::{multi_subscriber::MultiSubscriber, timeline::Timeline};
      2 
      3 use nostrdb::FilterBuilder;
      4 use notedeck::{RootNoteId, RootNoteIdBuf};
      5 
      6 pub struct Thread {
      7     pub timeline: Timeline,
      8     pub subscription: Option<MultiSubscriber>,
      9 }
     10 
     11 impl Thread {
     12     pub fn new(root_id: RootNoteIdBuf) -> Self {
     13         let timeline = Timeline::thread(root_id);
     14 
     15         Thread {
     16             timeline,
     17             subscription: None,
     18         }
     19     }
     20 
     21     pub fn filters_raw(root_id: RootNoteId<'_>) -> Vec<FilterBuilder> {
     22         vec![
     23             nostrdb::Filter::new().kinds([1]).event(root_id.bytes()),
     24             nostrdb::Filter::new().ids([root_id.bytes()]).limit(1),
     25         ]
     26     }
     27 }