Modernising IRC¶
Updated: May 07, 2024
IRC Protocol
IRC [1] is one of the oldest protocol from the Dinosaur Age [2] which is still alive. It is very simple, there is one
IRC Serverrunning somewhere in the Internet. You connect to that server using anIRC Client, join oneChannel(in other words aRoom), and start chatting with people in that channel.
Limitations
Since
IRCis very simple text based protocol, it doesn’t have a mechanism to store the history, means, if you disconnect from the server, you no longer receive messages from other people in theChannel. In Order to receive all the messages from a particularChannel, yourIRC Clientneed to stay connected with theIRC Server.Also, we cannot watch what is happening in the
Channelall the day. So, theIRC Clientshould have the ability to provide notification so that when you see the notification, you can decide whether you want to switch look at the conversation happening in theChannelor not. Most of theIRC Clientsdeveloped forDesktop Operating Systemsdo this notification without any issue. Also, they can stay connected with theIRC Serveras long as you keep them running.
IRCrequires the client to be connected to the server throughTCP Socket, but modern mobile operating systems don’t like apps which keep on running and stay connected throughTCP Socket, these modern mobile operating systems want the apps to use Push Notification [3] to save battery, these mobile operating systems will kill theIRC Clientprocess if they think that the process is not doing anything. Thus,IRC Clientsdeveloped forMobile Operating Systemscannot effectively stay connected forever withIRC ServerthroughTCP Socket.
WeeChat¶
WeeChat [4] is a terminal based IRC Client. Just like any other IRC Client, WeeChat provides all the functionality of an IRC Client and also provides functionalities more then the normal ordinary IRC Client. We can extend WeeChat through plugins. Plugins can be written using C, Python, Perl etc. Infact, most of the core functionalities are implemented as plugins in WeeChat.
WeeChat Relay¶
One of the plugin in WeeChat is called Relay. This plugin can act as a proxy so that you can use another IRC Client to connect to WeeChat and WeeChat will connect to the actual IRC Server. This plugin also provide another type of communication using WeeChat Protocol [5], we can use this protocol and write a WeeChat Client which act like WeeChat but without using IRC Protocol.
WeeChat Android¶
WeeChat Android [6] is a WeeChat Client for Android [7] which communicates with WeeChat running in a remote machine through WeeChat Protocol. WeeChat Android acts like WeeChat so we get a IRC Client for Android. WeeChat Android provides all the functionality of WeeChat but unfortunately it also suffers from the battery optimization in the Android operating system. It cannot stay connected to the remote WeeChat all the time. Also, WeeChat Android not able to use Push Notification because of the Proprietary Infrastructure [3] those Push Notifications depends on.
IrssiNotifier¶
IrssiNotifier [8] is one Android App which uses Push Notification to receive messages from a remote server. The IrssiNotifier Servers which send those Push Notification through the Proprietary Infrastructure are open for any valid clients to send those messages from a remote server.
We have to first create one client through IrssiNotifier website. Using the Client Id, we can develop one WeeChat plugin. This plugin will catch all the notification from WeeChat and send those notification messages to IrssiNotifier Servers. Those IrssiNotifier Servers then send those notification messages to IrssiNotifier Android App in our Android mobile. In this way, we can receive all the notification from WeeChat in our Mobile.
WeeNotifier¶
WeeNotifier [9] is a plugin for WeeChat which uses IrssiNotifier Infrastructure to broadcast notifications from WeeChat. With the combined use of Weechat, WeeChat Android and WeeNotifier, we can emulate a Modern Messaging System on top of IRC Protocol
Steps to Modernize IRC¶
These are the methods I used to improve my IRC experience on par with any Modern Messaging System especially in Android.
Lease one very small cloud VM to run
WeeChatcontinuously. You can also use your Desktop/Laptop to run WeeChat, but we need some way forWeeChat Androidrunning in the mobile to connect withWeeChatrunning in your Desktop/Laptop. You can ask yourInternet Service Providerto provide aStatic IPor you can useDynamic DNSmethod to make your Desktop/Laptop available through Internet. In the end, all we need is to somehow makeWeeChat Androidconnect toWeeChat.Keep
WeeChatrunning in that small cloud VM continuously.Configure
WeeChatto generate notification for all the messages of a particularChannel.Configure WeeChat Relay [10] in
WeeChatso thatWeeChat Androidcan connect securely.Install
WeeChat AndroidApp in your Mobile and configure it to connect to yourWeeChatrunning in the small cloud VM.Create an account in
IrssiNotifier Infrastructurethrough their website [11]. You need to generateClient Idto use it inWeeNotifierplugin as well as inIrssiNotifierAndroid App.Install WeeNotifier [12] plugin in
WeeChatto send notification toIrssiNotifier Servers. Configure it so that it is able to send data to the servers.Install
IrssiNotifierApp in your Mobile and configure it to connect to theIrssiNotifier Servers. If you want, you can change the encryption key to a different one from the default. In this case, you have to also configureWeeNotifierplugin inWeeChatwith the same encryption key.That’s all. When
WeeChatgenerate notifications, it will be captured byWeeNotifierand sent toIrssiNotifier Servers, thenIrssiNotifier Serverswill push those notifications toIrssiNotifierApp in your mobile, Once you see the notification, you can then openWeechat AndroidApp in your mobile to connect back toWeeChatto see whats going in theIRC Channel. Since,WeeChatis running continuously connected to actualIRC Server, the history is preserved.
Why I wrote WeeNotifier¶
When I was looking for some way to do push notifications from WeeChat, I came to know about IrssiNotifier and its Infrastructure. Immediately, I found that there is already one plugin available in WeeChat called IrssiNotifier which does exactly what I wanted. But when I tried, It didn’t work, I looked it to fix it, then I saw that the plugin invokes openssh for every message to do encryption. I’m not agree to do this way. Invoking a subprocess for each and every message is not a good thing.
So, I decided to write my own plugin. I know that WeeChat will not accept competing plugins for same functionality, but I don’t care whether WeeChat accepts or not. It is my own Itch which I scratched. I’m now happy with the result. I submitted [13] my plugin to WeeChat anyway.
