Skip to content

Commit

Permalink
Minor changes to improve code clarity.
Browse files Browse the repository at this point in the history
  • Loading branch information
andymandias committed Feb 20, 2024
1 parent 823ee17 commit 5d2629f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 4 additions & 4 deletions data/src/config/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ pub struct ServerMessages {
}

impl ServerMessages {
pub fn get(&self, server: &source::Server) -> (ServerMessage, Option<crate::user::Nick>) {
pub fn get(&self, server: &source::Server) -> ServerMessage {
match server {
source::Server::Join(nick) => (self.join, nick.to_owned()),
source::Server::Part(nick) => (self.part, nick.to_owned()),
source::Server::Quit(nick) => (self.quit, nick.to_owned()),
source::Server::Join(_) => self.join,
source::Server::Part(_) => self.part,
source::Server::Quit(_) => self.quit,
}
}
}
Expand Down
12 changes: 9 additions & 3 deletions data/src/history/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,13 +443,19 @@ impl Data {
let filtered = messages
.iter()
.filter(|message| match message.target.source() {
crate::message::Source::Server(Some(source)) => {
let (source, nick) = server_messages.get(source);
message::Source::Server(Some(source)) => {
let source_config = server_messages.get(source);

match source.exclude {
match source_config.exclude {
Exclude::All => false,
Exclude::None => true,
Exclude::Smart(seconds) => {
let nick = match source {
message::source::Server::Join(nick) => nick,
message::source::Server::Part(nick) => nick,
message::source::Server::Quit(nick) => nick,
};

if nick.is_some() {
!smart_filter_message(
message,
Expand Down

0 comments on commit 5d2629f

Please sign in to comment.