Skip to content

Commit 55e1e4b

Browse files
authored
Merge pull request #1842 from squidowl/labeled-response-context
Utilize `labeled-response` to Match Echoes
2 parents b1e4c37 + a7c9cd1 commit 55e1e4b

8 files changed

Lines changed: 585 additions & 322 deletions

File tree

data/src/capabilities.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::str::FromStr;
33
use std::string::ToString;
44
use std::sync::LazyLock;
55

6+
use chrono::{DateTime, Utc};
67
use irc::proto::{self, Tags, command, format};
78

89
use crate::message::formatting::{Modifier, update_formatting_with_modifier};
@@ -406,3 +407,19 @@ impl Capabilities {
406407
self.multiline_limits().is_some()
407408
}
408409
}
410+
411+
#[derive(Debug, Clone)]
412+
pub struct LabeledResponseContext {
413+
pub label_as_id: message::Id,
414+
pub server_time: DateTime<Utc>,
415+
}
416+
417+
impl LabeledResponseContext {
418+
pub fn new(message: &message::Encoded, label: &str) -> Self {
419+
Self {
420+
// Prefix ':' to ensure it cannot match any valid message id
421+
label_as_id: format!(":label={label}").into(),
422+
server_time: message.server_time_or_now(),
423+
}
424+
}
425+
}

0 commit comments

Comments
 (0)