Skip to content
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

Merged
merged 7 commits into from
Dec 21, 2020

Conversation

jlu5
Copy link
Contributor

@jlu5 jlu5 commented Dec 20, 2020

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.

3.0/m_relaymsg.cpp Outdated Show resolved Hide resolved
3.0/m_relaymsg.cpp Outdated Show resolved Hide resolved
3.0/m_relaymsg.cpp Outdated Show resolved Hide resolved
3.0/m_relaymsg.cpp Outdated Show resolved Hide resolved
Co-authored-by: Sadie Powell <sadie@witchery.services>
3.0/m_relaymsg.cpp Outdated Show resolved Hide resolved
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);
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Contributor Author

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

3.0/m_relaymsg.cpp Outdated Show resolved Hide resolved
3.0/m_relaymsg.cpp Outdated Show resolved Hide resolved
Co-authored-by: Sadie Powell <sadie@witchery.services>
cmd.fake_ident = tag->getString("ident", "relay");
cmd.fake_host = tag->getString("host", ServerInstance->Config->ServerName);

if (!ServerInstance->IsIdent(cmd.fake_ident))
Copy link
Member

@SadieCat SadieCat Dec 20, 2020

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).

@SadieCat SadieCat merged commit cf367e0 into inspircd:master Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants