So I wrote a mail client, and this morning I added the ability for it to receive input from a Unix domain socket.
In one terminal I have my email client open. In another I run:
lumailctl /tmp/foo.sock "open('/home/skx/Maildir/.livejournal.2014/');"
That opens the unix domain socket, and pipes the following command to it:
open('/home/skx/Maildir/.livejournal.2014/');
The mail client has already got the socket open, and the end result is that my mail client suddenly opens the specified mail folder, and redraws itself.
Neat.
The "open" function is obviously a lua function, which builds upon the lua primitives the client understands:
function open( folder ) clear_selected_folders() set_selected_folder(folder) index() end
Obviously this would be woefully insecure if it were released like this. Later I'll wire up some lua function to establish the socket, such that the user specifies where the socket is created (their home directory, ideally), and it doesn't run by default.
Tags: lua, lumail 2 comments
Wouldn't dbus be a good fit for this? And already include support for authentication?