Compare commits

..

No commits in common. "03f0ea717acaabd9859c6409a7cd0e24534d4ffc" and "ce5b4fb2ac7d5f4322ce1c6ea5012eefe9b7256d" have entirely different histories.

4 changed files with 49 additions and 50 deletions

View file

@ -1,46 +0,0 @@
use chrono::{DateTime, Local};
use std::collections::HashSet;
use crate::irc_message::IrcMessage;
pub struct Channel {
pub channel_name: Option<String>,
pub messages: Vec<IrcMessage>,
pub message_ids: HashSet<String>,
pub names: Vec<String>,
pub topic: Option<String>,
pub unread_messages: i32,
pub unread_highlights: i32,
pub unread_events: i32,
pub is_multiline: bool,
pub multiline_privmsgs: Option<Vec<String>>,
pub multiline_timestamp: Option<DateTime<Local>>,
pub multiline_nickname: Option<String>,
pub multiline_message_id: Option<String>,
}
impl Channel {
pub fn new(channel_name: Option<&str>) -> Self {
Self {
channel_name: channel_name.map(String::from),
messages: Vec::new(),
message_ids: HashSet::new(),
names: Vec::new(),
topic: None,
unread_messages: 0,
unread_highlights: 0,
unread_events: 0,
is_multiline: false,
multiline_privmsgs: None,
multiline_timestamp: None,
multiline_nickname: None,
multiline_message_id: None,
}
}
}

View file

@ -174,7 +174,12 @@ impl Cri {
.send( .send(
IrcCommand::Raw( IrcCommand::Raw(
"CHATHISTORY".into(), "CHATHISTORY".into(),
vec!["LATEST".into(), chanlist.into(), "*".into(), "100".into()], vec![
"LATEST".into(),
chanlist.into(),
"*".into(),
100.to_string(),
],
) )
.into(), .into(),
) )

View file

@ -1,4 +1,3 @@
mod channel;
mod cri; mod cri;
mod cri_flags; mod cri_flags;
mod irc_handler; mod irc_handler;

View file

@ -1,5 +1,4 @@
use crate::{ use crate::{
channel::Channel,
irc_message::{IrcMessage, MessageDetail}, irc_message::{IrcMessage, MessageDetail},
util::{self, BATCH_SUB_COMMAND_CHATHISTORY}, util::{self, BATCH_SUB_COMMAND_CHATHISTORY},
}; };
@ -11,7 +10,49 @@ use iced::{
Background, Color, Element, Length, Background, Color, Element, Length,
}; };
use irc::proto::BatchSubCommand; use irc::proto::BatchSubCommand;
use std::collections::HashMap; use std::collections::{HashMap, HashSet};
pub struct Channel {
pub channel_name: Option<String>,
pub messages: Vec<IrcMessage>,
pub message_ids: HashSet<String>,
pub names: Vec<String>,
pub topic: Option<String>,
pub unread_messages: i32,
pub unread_highlights: i32,
pub unread_events: i32,
pub is_multiline: bool,
pub multiline_privmsgs: Option<Vec<String>>,
pub multiline_timestamp: Option<chrono::DateTime<Local>>,
pub multiline_nickname: Option<String>,
pub multiline_message_id: Option<String>,
}
impl Channel {
fn new(channel_name: Option<&str>) -> Self {
Self {
channel_name: channel_name.map(String::from),
messages: Vec::new(),
message_ids: HashSet::new(),
names: Vec::new(),
topic: None,
unread_messages: 0,
unread_highlights: 0,
unread_events: 0,
is_multiline: false,
multiline_privmsgs: None,
multiline_timestamp: None,
multiline_nickname: None,
multiline_message_id: None,
}
}
}
pub struct MessageLog { pub struct MessageLog {
channels: HashMap<Option<String>, Channel>, channels: HashMap<Option<String>, Channel>,