replies actually work now.
Some checks failed
Rust CI / build-and-test (macOS-latest) (push) Has been cancelled
Rust CI / build-and-test (ubuntu-latest) (push) Has been cancelled
Rust CI / build-and-test (windows-latest) (push) Has been cancelled
Rust CI / cross-compile (macOS-latest, x86_64-pc-windows-gnu) (push) Has been cancelled
Rust CI / cross-compile (macOS-latest, x86_64-unknown-linux-gnu) (push) Has been cancelled
Rust CI / cross-compile (ubuntu-latest, x86_64-pc-windows-gnu) (push) Has been cancelled
Some checks failed
Rust CI / build-and-test (macOS-latest) (push) Has been cancelled
Rust CI / build-and-test (ubuntu-latest) (push) Has been cancelled
Rust CI / build-and-test (windows-latest) (push) Has been cancelled
Rust CI / cross-compile (macOS-latest, x86_64-pc-windows-gnu) (push) Has been cancelled
Rust CI / cross-compile (macOS-latest, x86_64-unknown-linux-gnu) (push) Has been cancelled
Rust CI / cross-compile (ubuntu-latest, x86_64-pc-windows-gnu) (push) Has been cancelled
This commit is contained in:
parent
337313b0bb
commit
4dc702bf5b
3 changed files with 26 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
use nostr::{Event, EventBuilder, Keys, Kind, PublicKey, Tag, TagKind, TagStandard};
|
||||
use nostr::{Event, EventBuilder, Keys, Kind, PublicKey, Tag, TagKind, TagStandard, EventId};
|
||||
use pollster::FutureExt as _;
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
@ -8,6 +8,8 @@ pub struct MailMessage {
|
|||
pub to: Vec<PublicKey>,
|
||||
pub cc: Vec<PublicKey>,
|
||||
pub bcc: Vec<PublicKey>,
|
||||
/// The events that this message references, uses to keep track of threads.
|
||||
pub parent_events: Vec<EventId>,
|
||||
pub subject: String,
|
||||
pub content: String,
|
||||
}
|
||||
|
@ -29,6 +31,10 @@ impl MailMessage {
|
|||
));
|
||||
pubkeys_to_send_to.push(*pubkey);
|
||||
}
|
||||
|
||||
for event in &self.parent_events {
|
||||
tags.push(Tag::event(*event));
|
||||
}
|
||||
|
||||
tags.push(Tag::from_standardized(TagStandard::Subject(
|
||||
self.subject.clone(),
|
||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -5,7 +5,8 @@ use egui::FontFamily::Proportional;
|
|||
use egui_extras::{Column, TableBuilder};
|
||||
use relay::RelayMessage;
|
||||
use std::collections::HashMap;
|
||||
use nostr::{SingleLetterTag, TagKind};
|
||||
use std::str::FromStr;
|
||||
use nostr::{EventId, SingleLetterTag, TagKind};
|
||||
use tracing::{debug, error, info, Level};
|
||||
|
||||
mod account_manager;
|
||||
|
@ -223,6 +224,7 @@ fn render_app(app: &mut Hoot, ctx: &egui::Context) {
|
|||
subject: String::new(),
|
||||
to_field: String::new(),
|
||||
content: String::new(),
|
||||
parent_events: Vec::new(),
|
||||
selected_account: None,
|
||||
minimized: false,
|
||||
};
|
||||
|
@ -416,10 +418,23 @@ fn render_app(app: &mut Hoot, ctx: &egui::Context) {
|
|||
// TODO: Handle delete
|
||||
}
|
||||
if ui.button("↩️ Reply").clicked() {
|
||||
let mut parent_events: Vec<EventId> = Vec::new();
|
||||
parent_events.push(unwrapped.rumor.id.unwrap());
|
||||
for tag in unwrapped.rumor.tags {
|
||||
if tag.kind() == TagKind::SingleLetter(SingleLetterTag::from_char('e').unwrap()) {
|
||||
if let Some(content) = tag.content() {
|
||||
match EventId::from_str(content) {
|
||||
Ok(id) => parent_events.push(id),
|
||||
Err(e) => error!("Error trying to add event to compose_window parent_events vec: {}", e),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let state = ui::compose_window::ComposeWindowState {
|
||||
subject: format!("Re: {}", subject),
|
||||
to_field: unwrapped.sender.to_string(),
|
||||
content: String::new(),
|
||||
parent_events,
|
||||
selected_account: None,
|
||||
minimized: false,
|
||||
};
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
use crate::mail_event::MailMessage;
|
||||
use crate::relay::ClientMessage;
|
||||
use eframe::egui::{self, RichText};
|
||||
use nostr::{Keys, PublicKey};
|
||||
use nostr::{EventId, Keys, PublicKey};
|
||||
use tracing::{debug, error, info};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ComposeWindowState {
|
||||
pub subject: String,
|
||||
pub to_field: String,
|
||||
pub parent_events: Vec<EventId>,
|
||||
pub content: String,
|
||||
pub selected_account: Option<Keys>,
|
||||
pub minimized: bool,
|
||||
|
@ -106,6 +107,7 @@ impl ComposeWindow {
|
|||
to: recipient_keys,
|
||||
cc: vec![],
|
||||
bcc: vec![],
|
||||
parent_events: state.parent_events.clone(),
|
||||
subject: state.subject.clone(),
|
||||
content: state.content.clone(),
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue