-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add m_relaymsg: stateless bridging using RELAYMSG #248
Add m_relaymsg: stateless bridging using RELAYMSG #248
Conversation
Co-authored-by: Sadie Powell <sadie@witchery.services>
3.0/m_relaymsg.cpp
Outdated
std::string fakeSource = GetFakeHostmask(nick); | ||
ClientProtocol::Messages::Privmsg privmsg(fakeSource, channel, text); | ||
// Tag the message as @relaymsg=<nick> so the sender can recognize it | ||
privmsg.AddTag("relaymsg", &captag, user->nick); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want to either draft prefix or vendor prefix this to avoid colliding with any potential ratified spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooof, I totally forgot to add the prefix here too :/
It looks like the other implementations already use @relaymsg so this is a bit of a breaking change. I'll see if I can coordinate a fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed this here and in the spec ircv3/ircv3-specifications@70c0957
Co-authored-by: Sadie Powell <sadie@witchery.services>
3.0/m_relaymsg.cpp
Outdated
cmd.fake_ident = tag->getString("ident", "relay"); | ||
cmd.fake_host = tag->getString("host", ServerInstance->Config->ServerName); | ||
|
||
if (!ServerInstance->IsIdent(cmd.fake_ident)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A possible issue: if a user edits their config and changes from a valid ident/host to an invalid ident/host then even if this throws the malformed config will still be applied.
To work around this you can put fake_ident and fake_host into a local variable then swap after all of the checks have been performed (also, move nick_separators to the end so it doesn't get applied till after the checks too).
RELAYMSG is my take on a lightweight bridging solution for IRC. It essentially takes in /RELAYMSG commands from authorized bots and translates them as spoofed PRIVMSGs to other clients.
I've been actively using this module on my network since May (with matterbridge as the client). Hopefully this is reasonable addition here.
Note: in terms of functionality this probably has some overlap with the recent
m_roleplay
, though these are two completely independent implementations AFAIK.