IRC (Internet Relay Chat) is a protocol that lets you communicate in text based chat rooms over the internet, and is basically what we all used to use in the 90’s before Twitter or WhatsApp. Think of it like multi-player notepad.

Most folk don’t even know it exists, but many technical people (especially those in the free software community) use IRC to facilitate discussion and development with people around the world.

I quite often use my Known site to share links with people over twitter and facebook, but to do the same with folk in IRC I’d have to paste the link by hand, and, well… I’m lazy. So I wrote a plugin!

One particularly handy thing you can do, combined with my command line API tools, is that you have a quick way to post from system services or internet connected (IoT) devices… but I’ll leave that as an exercise for the reader.

Known IRC

The Known IRC plugin adds the ability to syndicate short messages and share links to one or more IRC channels.

Once activated and configured, you will be able to syndicate out to IRC straight from your site.

Limitations

There are a couple of limitations of course…

  • IRC only lets you have one nickname per network (freenode, efnet etc), so if you sit on IRC as well, use a different nickname. Also consider registering this name with nickserv (the plugin supports nickserv passwords)
  • The plugin doesn’t perform a persistent login (for various reasons), therefore it’ll join, post and then leave the channel.

» Visit the project on Github...

2 thoughts on “IRC Support for Known

  1. The other week I wrote about a plugin I made that lets you syndicate content from a Known site to an IRC channel.
    Since folk using other platforms expressed an interest, I thought I’d quickly write down how to do it for the other indieweb folk out there.
    Getting started
    Writing content to an IRC channel is actually pretty straightforward, I’ll get onto the specifics of what you need to do in a moment, but your first step is to collect necessary information.
    At the very least you’ll need:
    Server details: Server (e.g. irc.freenode.net), Port (e.g 6667, or better, 6697 for TLS)
    The channel you want to post to (e.g. #indiewebcamp)
    The nickname to use (and password if your nick is protected by nickserv)
    Collect that information (or hard code it if it’s just for you), you’ll need it later.
    Making a post
    Posting some content to the channel after this is fairly straightforward. Obviously, if you want to persist on the channel you’ll need to start thinking about implementing a proper bot, but a single posting doesn’t need to get into that.
    The basic protocol is:
    Connect to the server on the given port, and I strongly suggest you use TLS.
    Greet the server by sending the following:

    USER *username* *username* bla :*username*rn
    NICK *username*


    12

    USER *username* *username* bla :*username*rnNICK *username*


    All the *username* bits in the first line are actually meant to be your username, fullname and nickname. For brevity, because I wasn’t writing a full client, I just used the same thing.
    Wait for response from server. At this point the server will spit back some information about the server, and may ask you some questions. You *should* parse that intelligently, but I couldn’t be bothered, so I just wait a few seconds.
    If you need to send a password to the nickserv, do so now:


    PRIVMSG NickServ :IDENTIFY *username* *password*


    1

    PRIVMSG NickServ :IDENTIFY *username* *password*



    Wait for response (or a few seconds) as before.
    Join your channel:


    JOIN #channel


    1

    JOIN #channel



    and wait for response.
    Post your message:


    PRIVMSG *#channel* :*your message*


    1

    PRIVMSG *#channel* :*your message*



    and wait…
    Quit:


    QUIT


    1

    QUIT



    and close your connection.
    If you want to experiment with this before you start coding, you can connect and do the whole exchange by hand via telnet/telnet-ssl, e.g:



    marcus@dushka:~$ telnet-ssl irc.freenode.net 6697
    USER example example bla :example
    NICK example

    …. server response ….

    PRIVMSG NickServ :IDENTIFY example somesecretpass

    ….

    JOIN #indiewebcamp

    ….

    PRIVMSG #indiewebcamp :Hello folks!

    ….

    QUIT


    12345678910111213141516171819

    marcus@dushka:~$ telnetssl irc.freenode.net 6697USER example example bla :exampleNICK example .... server response .... PRIVMSG NickServ :IDENTIFY example somesecretpass .... JOIN #indiewebcamp .... PRIVMSG #indiewebcamp :Hello folks! .... QUIT


    Some gotchas
    All in all, posting to an IRC channel is pretty straightforward, however there are a few things that can trip you up.
    Don’t be too fast: The main issue is that if you just open the connection and splurt your commands, you likely won’t get anywhere. The server will respond, and will expect you to listen to what it says. As I said above, the best thing is to read and process this response intelligently, but you can of get away with just waiting a few seconds… obviously YMMV.
    Nickname collisions: The above code doesn’t handle a situation where the nickname is already active on the network. I sidestep this issue by using a different username than my regular IRC handle for my syndication user, and to use nickserv to guard it. If you don’t want to take that approach you’re going to need to do something else, like parse the server response to detect the problem and present alternate nicks.
    Happy syndicating!


    Thanks for visiting! If you’re new here you might like to read a bit about me.
    (Psst… I am also available to hire! Find out more…)


    Follow @mapkyca
    !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?’http’:’https’;if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+’://platform.twitter.com/widgets.js’;fjs.parentNode.insertBefore(js,fjs);}}(document, ‘script’, ‘twitter-wjs’);


    Share this:EmailLinkedInTwitterGoogleFacebookReddit

Leave a Reply