Rocket.chat: Improve rocketchat-irc plugin

Created on 22 Jun 2015  Â·  45Comments  Â·  Source: RocketChat/Rocket.Chat

Current rocketchat-irc plugin just a prototype, I need do more works to improve it.

  • [ ] Add config to enable or disable this plugin
  • [x] Reconnect when connection failed between irc server
  • [x] Remove unused logs
  • [x] Show member status

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Triaged irc protocols

Most helpful comment

The Rocket.Chat team merged a pull request I made last week into the develop branch. These changes include:

  • An "IRC" settings page for administrators with haosdent's values mapped in as defaults. An admin can now change the IRC server, port, message cache size, and behavioral regular expressions via the web frontend.
  • A very crude Enable/Disable switch through the admin frontend.
  • The username and real name have been remapped properly to the Rocket.Chat user credentials as the previous method was neither ideal nor reliable. Once user-level settings are added, users will be able to override the username, real name, and password in their settings page. This is especially useful in environments where a user must use a pre-existing Rocket.Chat account which doesn't match their IRC account(s).
  • Performed some housecleaning to prep the package for future growth.
  • Added a README.md file with information on how to build Rocket.Chat with IRC support for testing.

I find that this package, for now, is very unstable and don't recommend anyone use it in a production environment. For instance, the legacy design adds remote IRC users as local Rocket.Chat users, room dynamics are glitchy and can affect Rocket.Chat functionality, and there aren't any robust checks and balances on IRC activity. In other words, things start to somewhat work, then break, then don't recover until restarting and reversing actions, etc. I'm going to do what I can to make the functionality at least a bit more predictable while maintaining the core vision of simply grafting IRC capabilities onto existing, similar, Rocket.Chat functionality. In the meantime, the process for building in IRC support remains obfuscated so nobody accidentally screws up their pre-existing environment.

As an active user of IRC Cloud, Slack, Rocket.Chat, and app-based IRC clients, Rocket.Chat with IRC capabilities will simplify my life and improve the IRC experience. All of the concerns people mentioned in this issue have been added to a to-do list (for review). I haven't looked into the Slackbridge suggestion for IRC, however, as I don't see bots as an option for all demographics and I think haosdent made a good foundation to grow from. That doesn't mean it won't happen. :-)

All 45 comments

Is this going to achieve something like https://www.irccloud.com/ ?

No sure, I just do it for fun. But I need to make this plugin reliable for other users which want to use it

For @posix4e 's question, I think it could replace irccloud finally.

That's the spirit @haosdent ! :+1:

Interesting read (try to read to the end - I know its a little dry):

http://thenextweb.com/insider/2015/03/24/slack-is-quietly-unintentionally-killing-irc/

Then read the _real_, zero-hype account of the very same need/trend referenced by Pierre above.

This is no longer a technology looking for a solution; but an identified trending market void.

Rocket.Chat can service this niche better than Slack, and give them the forever-FREE, forever-in-their-control promise that they are looking for.

Depends on #222

Hi, this plugin is used for connect irc server. Not provide irc server and wait other client connect it through irc protocol.

Hi @haosdent and thanks for your work :) Do you have some sort of doc on how to install it? Thanks!

Thanks for working on this!

I feel like this plugin should have a primary focus, as I keep hearing that this sort of connection is super important for projects with existing IRC communities. "Prototype" ain't gonna nail it.

https://www.bountysource.com/issues/22748500-improve-rocketchat-irc-plugin

Ok, I figured out:
You have to uncomment this line: https://github.com/RocketChat/Rocket.Chat/blob/develop/.meteor/packages#L96

I have a working example here: https://chat.indie.host/channel/indiehosters

I have various remarks on the way it is working and the way we could improve it.

  • [ ] disable auto-join for users
  • [ ] disable auto join for channels
  • [ ] add possibility for admin/moderator to link a channel to irc
  • [ ] when a user join this channel, make him join irc
  • [ ] add possibility for a user to specify nick/pass on irc
  • [ ] admin should be able to specify irc server (I'm fine with freenode at the beginning)

@simison do you to try? (You could create a channel #trustroots and it will auto join the irc channel)

I could work on thess features, but I need ca$h :) Do you think we could run a mini crowdfunding between IndieHosters/Hitchwiki for that? Or is it good enough as this?

I actually love IRC have been using it for almost 18 years, how much money is needed, to write a reliable plugin that can be toggeld on/ off if needed.

I came looking for the same thing as @pierreozoux: instructions on how to enable this. The readme for the package is unhelpful: https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/rocketchat-irc/Readme.md

Is it possible to enable this from a Sandstorm grain?

Looking at the implementation, this could be both simpler and more robust as a server-to-server based plugin. In servet-to-server IRC, a single connection is made to a peer IRC server, and Rocket chat would send a password and identify itself as a server. Over that single connection Rocket Chat and the IRC server would communicate joins/leaves/messages/etc.

That also means that messages to channels are only sent once over a single connection instead of once per client. There wouldn't be any need for caches and deduplication. I'm also assuming this would scale better for a large number of users/messages.

I'd like to take a stab at this, but wanted to see what your reaction is.

@marceloschmidt can we base this at the slack-bridge package?

Is anyone still working on this plugin?

@mpetersen42 no one from the @RocketChat/core team. But @marceloschmidt have been working on the new version of SlackBridge https://github.com/RocketChat/Rocket.Chat/pull/3962 and I believe there is a lot that can be re-used from it.

I am looking forward to an update :D

As a head's up to those of you interested in this project, some minor development changes have occurred to rocketchat-irc over the past year. You can view the development branch commit history here:

https://github.com/RocketChat/Rocket.Chat/commits/develop/packages/rocketchat-irc

The Rocket.Chat team merged a pull request I made last week into the develop branch. These changes include:

  • An "IRC" settings page for administrators with haosdent's values mapped in as defaults. An admin can now change the IRC server, port, message cache size, and behavioral regular expressions via the web frontend.
  • A very crude Enable/Disable switch through the admin frontend.
  • The username and real name have been remapped properly to the Rocket.Chat user credentials as the previous method was neither ideal nor reliable. Once user-level settings are added, users will be able to override the username, real name, and password in their settings page. This is especially useful in environments where a user must use a pre-existing Rocket.Chat account which doesn't match their IRC account(s).
  • Performed some housecleaning to prep the package for future growth.
  • Added a README.md file with information on how to build Rocket.Chat with IRC support for testing.

I find that this package, for now, is very unstable and don't recommend anyone use it in a production environment. For instance, the legacy design adds remote IRC users as local Rocket.Chat users, room dynamics are glitchy and can affect Rocket.Chat functionality, and there aren't any robust checks and balances on IRC activity. In other words, things start to somewhat work, then break, then don't recover until restarting and reversing actions, etc. I'm going to do what I can to make the functionality at least a bit more predictable while maintaining the core vision of simply grafting IRC capabilities onto existing, similar, Rocket.Chat functionality. In the meantime, the process for building in IRC support remains obfuscated so nobody accidentally screws up their pre-existing environment.

As an active user of IRC Cloud, Slack, Rocket.Chat, and app-based IRC clients, Rocket.Chat with IRC capabilities will simplify my life and improve the IRC experience. All of the concerns people mentioned in this issue have been added to a to-do list (for review). I haven't looked into the Slackbridge suggestion for IRC, however, as I don't see bots as an option for all demographics and I think haosdent made a good foundation to grow from. That doesn't mean it won't happen. :-)

@toxicgumbo There is a pull request here, I'm not sure you saw it.
https://github.com/RocketChat/Rocket.Chat/pull/4667

It looks like the PR is bringing some significant improvement.

@pierreozoux Sincere gratitude for the notice on #4667! I'm thrilled to see added momentum and increased interest, especially when it excites core developers. Looks like substantial work and I'm glad to see you've been involved in the discussion.

In latest rocket chat update irc option is in settings not sure it works tho

How do you use this plugin? Once you connect to an IRC server, do you join channels on IRC through Rocket.Chat? How do you use this plugin after enabling it?

Being that this is now present in the stable releases... I tried to use it and all it seems to do is crash the server by entering into a loop that consumed 100% cpu. I haven't been able to use this successfully yet. Will work on getting more debug information.

I don't believe the new work to it from: https://github.com/RocketChat/Rocket.Chat/pull/4667 has been merged. I'm guessing some of those changes might fix the issue you are having

Uhm there is a way to move a specific channel to another one inside rocketchat?

For me the IRC plugin worked great, what would be great if one could decide which channel/channels should join the IRC network.

I bumped pull request https://github.com/RocketChat/Rocket.Chat/pull/4667 in hopes of some movement. @cpitman has taken this in such a (hopeful) direction that it's more or less prohibitive for anyone else to make incremental changes to the current source.

A bit of profile snooping on my part. @cpitman seemed to take a vacation at the beginning of the year.

Eager to test this, but wondering how to join a channel once connected to the server..

I've enabled this through the admin panel, I can see it connecting in the logs, however I'm not sure how to join an existing irc channel or make it actually do anything? The readme isn't helpful. I'm more than happy to update it if someone can give me direction.

The Readme was just to get something in print so people could even get IRC working at all. You should be able to change rooms like you would normally in RocketChat and that sends the proper IRC commands on the backend to put you in a channel of the same name. During the last time I tried this and worked on it, the mapping between the two left a lot to be desired and often led to errors. That is, if it worked, it worked just well enough; if it didn't work and an error was produced, you pretty much were stuck in a situation where you had to quit RocketChat and restart. I haven't tried the most recent changes yet, so perhaps this has been improved through something subtle.

If the scope of the bounty can be more clearly defined, including getting a working bi-directional plugin that also allows PMs in both ways I'm more than happy to throw in $100

What do those here think of #10113 basically would allow deploying of a small ircd that would federate with Rocket.Chat. Then allowing irc users to talk via irc/rocket.chat

This would be more seamless. Users connected on irc would be real users of Rocket.Chat. They could take their same login and connect to Rocket.Chat.

I like the idea.. But Real users? What if the rocket.chat instance users are fuelled by a LDAP user base ie: cloudron? On Apr 4, 2018 9:11 PM, Aaron Ogle notifications@github.com wrote:What do those here think of #10113 basically would allow deploying of a small ircd that would federate with Rocket.Chat. Then allowing irc users to talk via irc/rocket.chat
This would be more seamless. Users connected on irc would be real users of Rocket.Chat. They could take their same login and connect to Rocket.Chat.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

Based on the comments in #1259, now closed, and the last paragraph in your comments, I read that as if this means IRC users who have a matching username in Rocket.Chat will be able to connect in from IRC and chat with Rocket.Chat users. Is this correct? Does this approach abandon the desire expressed in this thread where Rocket.Chat users wish to render IRC channels as rooms within Rocket.Chat and dialogue with IRC-only users? The advantage to this latter approach is where shops are running Rocket.Chat, but employees might also require IRC interactions and prefer the modernized handling of content that Rocket.Chat provides while still allowing for viewing/setting permissions, etc.

For sure doesn't mean that we are abandoning. Just was curious if helped solve some peoples use cases.

I have two feature requests for this integration which I can't find any information about,
When connecting rocketchat to an IRC server

  • [ ] SSL support
  • [ ] Password support

This whole thread needs to be reviewed once we merge the IRC Federation: RFC2813 implementation (ngIRCd)
https://github.com/RocketChat/Rocket.Chat/pull/10113

Any update for this feature? I just tried to use it but I could not reach any success. To be honest I could not find a proper documentation about the IRC setting page as well as how it should act after a proper setup.

I am happy to help in debugging as much as I can. The latest log, hope it helps.
[irc][server] Unhandled peer message: {"prefix":"barjavel.freenode.net","server":"barjavel.freenode.net","command":"NOTICE","rawCommand":"NOTICE","commandType":"normal","args":["*","*** Looking up your hostname..."]} [irc][server] Unhandled peer message: {"prefix":"barjavel.freenode.net","server":"barjavel.freenode.net","command":"NOTICE","rawCommand":"NOTICE","commandType":"normal","args":["*","*** Checking Ident"]} [irc][server] Unhandled peer message: {"prefix":"barjavel.freenode.net","server":"barjavel.freenode.net","command":"NOTICE","rawCommand":"NOTICE","commandType":"normal","args":["*","*** Found your hostname"]} [irc][server] Unhandled peer message: {"prefix":"barjavel.freenode.net","server":"barjavel.freenode.net","command":"NOTICE","rawCommand":"NOTICE","commandType":"normal","args":["*","*** No Ident response"]} [irc][server] Unhandled peer message: {"prefix":"barjavel.freenode.net","server":"barjavel.freenode.net","command":"err_needmoreparams","rawCommand":"461","commandType":"error","args":["*","SERVER","Not enough parameters"]} [irc][server] Unhandled peer message: {"command":"ERROR","rawCommand":"ERROR","commandType":"normal","args":["Closing Link: 127.0.0.1 (Connection timed out)"]} [irc][server] Connection Closed

Version:
âž” System âž” startup âž” +----------------------------------------------------+ âž” | SERVER RUNNING | âž” +----------------------------------------------------+ âž” | | âž” | Rocket.Chat Version: 0.68.5 | âž” | NodeJS Version: 8.11.3 - x64 | âž” | Platform: linux | âž” | Process Port: 3000 | âž” | Site URL: xxxxxxxxxxxxxxxxxxxx | âž” | ReplicaSet OpLog: Disabled | âž” | Commit Hash: e412d018f8 | âž” | Commit Branch: HEAD | âž” | | âž” +----------------------------------------------------+

Hi,
I could not get the IRC Federation working. After some debugging and reading the RFC, i found the following solution:

onConnect() {
    this.log('Connected! Registering as server...');
    this.write({
      command: 'PASS',
      parameters: [this.config.passwords.local] //Removed the other parameters since these should not be passed from client to server. According to the RFC. When these are passed, you will always get an authorisation failed on the IRC link
    });
    this.write({
      command: 'SERVER',
      parameters: [this.config.server.name, '1'], \\Added the 1 because it needs this as <hops> value, according to the RFC. If not, you will see an error that the SERVER command does not have enough parameters.
      trailer: this.config.server.description
    });
  }

Now still the bridge is not working, but at least the connection is setup now...
```
Received PASS command, continue registering...
Handling peer message: SERVER irc.xxx.nl 1 : IRC Server
Received SERVER command, waiting for first PING...
[JOIN and MODE and such....]
[irc][server] Handling peer message: PING :irc.xxx.nl
[irc][server] Sending Command: :xxx.yyy.nl PONG irclink.xxx.nl

Hello,

I am trying to connect my IRCd (UnrealIRCd v.4) to Rocket.Chat. Unfortunately it is not working. Error (log file) is attached below this post. Any idea how to solve this issue?

Kind regards,

Steps to reproduce:

IRC Federation settings:
Enabled: True
Protocol: RFC2813
Host: irc.server.si
Port: 65520
Name: irc.server.si
Description: Chat.si IRC Bridge
Local Password: Empty
Peer Password: IRCD password I guess?

Server Setup Information:

  • Version of Rocket.Chat Server: 1.1.1
  • Operating System: Debian 9
  • Deployment Method: Manual Debian Installation (https://rocket.chat/docs/installation/manual-installation/debian/)
  • Number of Running Instances: 1
  • DB Replicaset Oplog: mmapv1
  • NodeJS Version: 8.11.4
  • MongoDB Version: 4.0.10

Relevant logs:

I20190605-13:58:43.787(2) Updating process.env.MAIL_URL
I20190605-13:58:44.070(2) [irc][server] Connecting to @irc.server.si:65520
I20190605-13:58:44.076(2) [irc][server] Connected! Registering as server...
I20190605-13:58:44.078(2) [irc][server] Sending Command: PASS 0210 ngircd
I20190605-13:58:44.078(2) [irc][server] Sending Command: SERVER irc.server.si :server.si IRC Bridge
I20190605-13:58:44.082(2) [irc][server] Unhandled peer message: {"prefix":"irc.server.si","server":"irc.server.si","command":"NOTICE","rawCommand":"NOTICE","commandType":"normal","args":[""," Looking up your hostname..."]}
I20190605-13:58:44.082(2) [irc][server] Unhandled peer message: {"prefix":"irc.server.si","server":"irc.server.si","command":"NOTICE","rawCommand":"NOTICE","commandType":"normal","args":["","
Found your hostname (cached)"]}
I20190605-13:58:46.226(2) [irc][server] Unhandled peer message: {"command":"ERROR","rawCommand":"ERROR","commandType":"normal","args":["Not enough SERVER parameters"]}
I20190605-13:58:46.227(2) [irc][server] Unhandled peer message: {"command":"ERROR","rawCommand":"ERROR","commandType":"normal","args":["Closing Link: [94.130.225.252] (Not enough parameters)"]}
I20190605-13:58:46.233(2) [irc][server] Connection Closed
I20190605-13:58:46.657(2) âž” server.js:207 System âž” startup

Ok, how I finally managed to connect Rocket.Chat and IRCd. Just like @RickvLeeuwen it is necessary to edit the app.js file:

onConnect() { this.log('Connected! Registering as server...'); this.write({ command: 'PASS', parameters: [this.config.passwords.local] //Removed the other parameters since these should not be passed from client to server. According to the RFC. When these are passed, you will always get an authorisation failed on the IRC link }); this.write({ command: 'SERVER', parameters: [this.config.server.name, '1'], \\Added the 1 because it needs this as <hops> value, according to the RFC. If not, you will see an error that the SERVER command does not have enough parameters. trailer: this.config.server.description }); }

In addition, the link block must be enabled in the IRCd config file, so that the servers can connect to one another.

My unrealircd.conf:
`listen {
         ip 127.0.0.1;
         port 6900;
         / * options {serversonly; }; * /
};

link www.yourdomain.com
{
         incoming {
                 mask *;
         };
 
         outgoing {
                 bind-ip *;
                 hostname 127.0.0.1;
                 port 6900;
         };
 
         password "pass";
 
         class servers;
};`

So far so good now I see in syslog following output:

Jun 5 16:30:13 cryptowall rocketchat[7267]: Loaded the Apps Framework and loaded a total of 1 Apps!
Jun 5 16:30:14 cryptowall rocketchat[7267]: [irc][server] Connecting to @localhost:6900
Jun 5 16:30:14 cryptowall rocketchat[7267]: [irc][server] Connected! Registering as server...
Jun 5 16:30:14 cryptowall rocketchat[7267]: [irc][server] Sending Command: PASS password
Jun 5 16:30:14 cryptowall rocketchat[7267]: [irc][server] Sending Command: SERVER www.server.si 1 :Server.si IRC Bridge
Jun 5 16:30:14 cryptowall rocketchat[7267]: [irc][server] Unhandled peer message: {"prefix":"irc.server.si","server":"irc.server.si","command":"NOTICE","rawCommand":"NOTICE","commandType":"normal","args":[""," Looking up your hostname..."]}
Jun 5 16:30:14 cryptowall rocketchat[7267]: [irc][server] Unhandled peer message: {"prefix":"irc.server.si","server":"irc.server.si","command":"NOTICE","rawCommand":"NOTICE","commandType":"normal","args":["","
Found your hostname (cached)"]}
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Handling peer message: PASS :password
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Received PASS command, continue registering...
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Unhandled peer message: {"command":"PROTOCTL","rawCommand":"PROTOCTL","commandType":"normal","args":["NOQUIT","NICKv2","SJOIN","SJOIN2","UMODE2","VL","SJ3","TKLEXT","TKLEXT2","NICKIP","ESVID","SJSBY"]}
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Unhandled peer message: {"command":"PROTOCTL","rawCommand":"PROTOCTL","commandType":"normal","args":["CHANMODES=beI,kLf,l,psmntirzMQNRTOVKDdGPZSCc","USERMODES=iowrsxzdHtIDZRqpWGTSB","BOOTED=1559719023","PREFIX=(qaohv)~&@%+","NICKCHARS=","SID=001","MLOCK","TS=1559745016","EXTSWHOIS"]}
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Handling peer message: SERVER irc.server.si 1 :U4203-Fhin6OoEM-001 Chat Server
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Received SERVER command, waiting for first PING...
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Unhandled peer message:
{"prefix":"irc.server.si","server":"irc.server.si","command":"SMO","rawCommand":"SMO","commandType":"normal","args":["o","(\u0002link\u0002) Link irc.server.si -> www.server.si[@127.0.0.1.54064] established"]}
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Unhandled peer message: {"prefix":"irc.server.si","server":"irc.server.si","command":"MD","rawCommand":"MD","commandType":"normal","args":["client","irc.server.si","link-security","2"]}
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Handling peer message: :irc.server.si SERVER services.server.si 2 :Services for IRC Networks
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Received SERVER command, waiting for first PING...
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Unhandled peer message: {"prefix":"services.server.si","server":"services.server.si","command":"EOS","rawCommand":"EOS","commandType":"normal","args":["EOS"]}
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Unhandled peer message: {"prefix":"services.server.si","server":"services.server.si","command":"SINFO","rawCommand":"SINFO","commandType":"normal","args":["0","0","","","",""]}
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Handling peer message: NICK chat26425 1 1559719136 Dark hostname.org irc.server.si 0 +iowxzHtIRqWT chat.147DE31.dynamic.siol.net :realname
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Emitting peer command to local: {"identifier":"nickChanged","args":{"newNick":"chat26425"}}
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Unhandled peer message: {"prefix":"irc.server.si","server":"irc.server.si","command":"SWHOIS","rawCommand":"SWHOIS","commandType":"normal","args":["chat26425","Staff @ server.si"]}
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Handling peer message: :chat26425 JOIN #podpora
Jun 5 16:30:16 cryptowall rocketchat[7267]: [irc][server] Emitting peer command to local: {"identifier":"joinedChannel","args":{"roomName":"podpora","nick":"chat26425"}}

... so in syslog I can see things going here and there, but unfortunately I don't see people from IRCd on Rocket.chat or the other way around. Nothing is also printed on #klepet channel on Rocket.Chat. Even if you type something on Rocket.chat channel #klepet nothing is printed on IRCd site. Also users on IRCd are not visible in Rocket.Chat. Any idea how to sync ?

Kind regards,

I haven't found a way to edit the snapd locally.
It looks like the file would be app/irc/server/servers/RFC2813/index.js

Is there a pull request to update this?

We have merged https://github.com/RocketChat/Rocket.Chat/pull/10113

If there are additional concerns or problems, let's open new tickets against the new feature. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattlin picture mattlin  Â·  3Comments

tanc picture tanc  Â·  3Comments

sta-szek picture sta-szek  Â·  3Comments

amayer5125 picture amayer5125  Â·  3Comments

antn89 picture antn89  Â·  3Comments