net-irc-mala
· 🪦 retired
A gateway for reading mala’s timeline over IRC. It runs locally as a small IRC server; connect with an IRC client and posts stream into the #malastream channel in real time.
As far as the code shows, the upstream is a streaming API at http://api.ma.la/home_timeline/stream, which delivers JSON containing a body (text) and an author (user.screen_name) — a microblog-style timeline.
Internals
The flow between the IRC client and the streaming API.
- mig.rb (
bin/mig.rb) — the bundled executable. It is a single line,Net::IRC::CLI.run(Net::IRC::Mala, ARGV), delegating all startup handling to the CLI - Net::IRC::CLI (
lib/net/irc/cli.rb) — parses options with OptionParser (-pport,-hhost,-llog file,--debug,-fforeground) and starts theNet::IRC::Serverfrom the net-irc gem. By default it listens onlocalhost:16701and daemonizes via fork +setsid(foreground with--debug/-f). Logging uses Logger with daily rotation - Net::IRC::Mala (
lib/net/irc/mala.rb) — the session itself, subclassing net-irc’sNet::IRC::Server::Session. When a client completes USER registration, it JOINs them into#malastream, sets the channel modes (+mtoplus+o/+qfor itself), and starts the streaming thread - The streaming thread connects to the API via Server-Sent Events using EventMachine + em-eventsource, parses incoming messages as JSON, and relays them into
#malastreamas PRIVMSGs withscreen_nameas the sender. Messages that fail to parse are skipped, with an error printed to STDERR - When the client disconnects, the streaming thread is killed
The server name, channel name, and so on are hard-coded in Net::IRC::Mala; there is no config file. The gem version is 0.0.1.