Skip to content

Commit

Permalink
Merge pull request #366 from andymandias/feat/message-tags
Browse files Browse the repository at this point in the history
Message Tags Support
  • Loading branch information
casperstorm authored May 1, 2024
2 parents c40ae38 + 2b0ee7f commit 0acaf1d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Added:
- Allow configuration of internal messages in buffer (see [buffer configuration](https://halloy.squidowl.org/configuration/buffer.html#bufferinternal_messages-section))
- User information added to context menu
- Support for IRCv3 `CAP NEW` and `CAP DEL` subcommands
- Enable support for IRCv3 `multi-prefix`, `WHOX`, and `UTF8ONLY`
- Enable support for IRCv3 `multi-prefix`, `message-tags`, `WHOX`, and `UTF8ONLY`
- Dynamic commands and tooltips added to command auto-completion via `ISUPPORT`
- Added support for `socks5` proxy configuration (see [proxy configuration](https://halloy.squidowl.org/configuration/proxy.html))
- Added support for `http` proxy configuration (see [proxy configuration](https://halloy.squidowl.org/configuration/proxy.html))
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Join **#halloy** on libera.chat if you have questions or looking for help.
* [sasl-3.1](https://ircv3.net/specs/extensions/sasl-3.1)
* [cap-notify](https://ircv3.net/specs/extensions/capability-negotiation.html#cap-notify)
* [multi-prefix](https://ircv3.net/specs/extensions/multi-prefix)
* [message-tags](https://ircv3.net/specs/extensions/message-tags)
* [`WHOX`](https://ircv3.net/specs/extensions/whox)
* [`UTF8ONLY`](https://ircv3.net/specs/extensions/utf8-only)
* SASL support
Expand Down
1 change: 1 addition & 0 deletions book/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* [sasl-3.1](https://ircv3.net/specs/extensions/sasl-3.1)
* [cap-notify](https://ircv3.net/specs/extensions/capability-negotiation.html#cap-notify)
* [multi-prefix](https://ircv3.net/specs/extensions/multi-prefix)
* [message-tags](https://ircv3.net/specs/extensions/message-tags)
* [`WHOX`](https://ircv3.net/specs/extensions/whox)
* [`UTF8ONLY`](https://ircv3.net/specs/extensions/utf8-only)
* SASL support
Expand Down
9 changes: 9 additions & 0 deletions data/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ impl Client {
if contains("away-notify") {
requested.push("away-notify");
}
if contains("message-tags") {
requested.push("message-tags");
}
if contains("server-time") {
requested.push("server-time");
}
Expand Down Expand Up @@ -393,6 +396,9 @@ impl Client {
if newly_contains("away-notify") {
requested.push("away-notify");
}
if newly_contains("message-tags") {
requested.push("message-tags");
}
if newly_contains("server-time") {
requested.push("server-time");
}
Expand Down Expand Up @@ -929,6 +935,9 @@ impl Client {

return None;
}
Command::TAGMSG(_) => {
return None;
}
_ => {}
}

Expand Down
1 change: 1 addition & 0 deletions data/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ fn target(
| Command::CNOTICE(_, _, _)
| Command::CPRIVMSG(_, _, _)
| Command::KNOCK(_, _)
| Command::TAGMSG(_)
| Command::USERIP(_)
| Command::HELP(_)
| Command::MODE(_, _, _)
Expand Down
5 changes: 5 additions & 0 deletions irc/proto/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ pub enum Command {
CPRIVMSG(String, String, String),
/// <channel> [<message>]
KNOCK(String, Option<String>),
/// <msgtarget>
TAGMSG(String),
/// <nickname>
USERIP(String),

Expand Down Expand Up @@ -193,6 +195,7 @@ impl Command {
"CNOTICE" if len > 2 => CNOTICE(req!(), req!(), req!()),
"CPRIVMSG" if len > 2 => CPRIVMSG(req!(), req!(), req!()),
"KNOCK" if len > 0 => KNOCK(req!(), opt!()),
"TAGMSG" if len > 0 => TAGMSG(req!()),
"USERIP" if len > 0 => USERIP(req!()),
_ => Self::Unknown(tag, params.collect()),
}
Expand Down Expand Up @@ -246,6 +249,7 @@ impl Command {
Command::CNOTICE(a, b, c) => vec![a, b, c],
Command::CPRIVMSG(a, b, c) => vec![a, b, c],
Command::KNOCK(a, b) => std::iter::once(a).chain(b).collect(),
Command::TAGMSG(a) => vec![a],
Command::USERIP(a) => vec![a],
Command::Numeric(_, params) => params,
Command::Unknown(_, params) => params,
Expand Down Expand Up @@ -300,6 +304,7 @@ impl Command {
CNOTICE(_, _, _) => "CNOTICE".to_string(),
CPRIVMSG(_, _, _) => "CPRIVMSG".to_string(),
KNOCK(_, _) => "KNOCK".to_string(),
TAGMSG(_) => "TAGMSG".to_string(),
USERIP(_) => "USERIP".to_string(),
Numeric(numeric, _) => format!("{:03}", *numeric as u16),
Unknown(tag, _) => tag.clone(),
Expand Down

0 comments on commit 0acaf1d

Please sign in to comment.