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 Server
running 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
IRC
is 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 Client
need to stay connected with theIRC Server
.Also, we cannot watch what is happening in the
Channel
all the day. So, theIRC Client
should 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 theChannel
or not. Most of theIRC Clients
developed forDesktop Operating Systems
do this notification without any issue. Also, they can stay connected with theIRC Server
as long as you keep them running.
IRC
requires 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 Client
process if they think that the process is not doing anything. Thus,IRC Clients
developed forMobile Operating Systems
cannot effectively stay connected forever withIRC Server
throughTCP 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
WeeChat
continuously. You can also use your Desktop/Laptop to run WeeChat, but we need some way forWeeChat Android
running in the mobile to connect withWeeChat
running in your Desktop/Laptop. You can ask yourInternet Service Provider
to provide aStatic IP
or you can useDynamic DNS
method to make your Desktop/Laptop available through Internet. In the end, all we need is to somehow makeWeeChat Android
connect toWeeChat
.Keep
WeeChat
running in that small cloud VM continuously.Configure
WeeChat
to generate notification for all the messages of a particularChannel
.Configure WeeChat Relay [10] in
WeeChat
so thatWeeChat Android
can connect securely.Install
WeeChat Android
App in your Mobile and configure it to connect to yourWeeChat
running in the small cloud VM.Create an account in
IrssiNotifier Infrastructure
through their website [11]. You need to generateClient Id
to use it inWeeNotifier
plugin as well as inIrssiNotifier
Android App.Install WeeNotifier [12] plugin in
WeeChat
to send notification toIrssiNotifier Servers
. Configure it so that it is able to send data to the servers.Install
IrssiNotifier
App 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 configureWeeNotifier
plugin inWeeChat
with the same encryption key.That’s all. When
WeeChat
generate notifications, it will be captured byWeeNotifier
and sent toIrssiNotifier Servers
, thenIrssiNotifier Servers
will push those notifications toIrssiNotifier
App in your mobile, Once you see the notification, you can then openWeechat Android
App in your mobile to connect back toWeeChat
to see whats going in theIRC Channel
. Since,WeeChat
is 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.