Wednesday, April 22, 2009

IRC

Does anyone get on IRC anymore? Back in Arth’s dynasty, we did practically everything on there…

Comments

Kevan: he/him

23-04-2009 11:32:35 UTC

I think it’s died because we’ve lost the sidebar view of how many people are in the room (SlashNet took down their page that we were scraping, possibly automatically because of the hits it was getting). I did update it to say that, I don’t know how it became “1 user.”

If anyone can point me at a URL resource that gives me details of who’s in the IRC room (or a way for PHP to access IRC and poke around directly), I’ll put it back up.

ais523:

23-04-2009 20:04:24 UTC

I’m on IRC more or less all the time I’m online. Generally speaking, though, nobody else is in there.

Writing an IRC bot is pretty simple, but it would have to stay in the channel constantly; IRC servers get annoyed when bots keep joining and quitting. There might be code for a PHP IRC bot lying around somewhere, but it’s probably best just to put a standard IRC bot in the channel keeping track of who’s there, and make it display its own page that BlogNomic can scrape.

Kevan: he/him

23-04-2009 22:49:04 UTC

I know virtually nothing about IRC; if anyone could set that bot up and give me a URL, I’ll work it into the sidebar.

ais523:

25-04-2009 14:16:22 UTC

I’ve set up a bot that’s just monitoring the names list in #nomic. You can see the list (raw format) at http://normish.org/nomicnames.irc; in order to just get the nicks, ignore everything before the second colon on each line, and all punctuation marks (they reflect who’s got op, voice, etcetera).

In case it gets lost, here’s blognomicbot’s source:

#! /usr/bin/perl -pT
$|=1;
$x=0;
$channel=”#nomic”;
$p=”“;
/^PING (.*\r?\n?)$/ and $_ = $p = “PONG $1\r\nNAMES #nomic\r\n” and $x=1;
/^:[^ ]* 376/ and $_=”${p}JOIN $channel\r\n” and $send = 4997 and $x=1;
/^:[^ ]* 353/ and $l.=$_;;
if(/^:[^ ]* 366/) {
    open $fh, ‘>’, ‘nomicnames.irc’;
    print $fh $l;
    $l=”“;
    close $fh;
}
!defined($global) || !$global and (($global=1),($_=“NICK blognomicbot\r\nUSER blognomicbot localhost moo.slashnet.org :BlogNomic Bot\r\n”),($x=1));
$x or $_=’‘;

It needs an external program like netcat to connect it in a loop to IRC, though. (Normish = rootnomic, another nomic which also happens to be a computer.) There’s a bit of redundant code there, it was hastily modified from another bot. Note that the webpage won’t update instantly, but rather once every couple of minutes or so.

If anyone can think of any other features it might be useful for BlogNomic Bot to have, please let me know.

Kevan: he/him

25-04-2009 18:17:50 UTC

Okay, got it, the sidebar is now feeding off of that URL. Thanks for putting it together.

ais523:

26-04-2009 10:55:18 UTC

It still just says “1 user” for me…

Kevan: he/him

26-04-2009 12:24:37 UTC

It’s just http://blognomic.com/irc/scrape.html in an IFRAME. Could be something else updating the same file (I’m still not sure where it ever got “1 user” from; I replaced scrape.html with plain text when I switched off the cron job), but it’s probably just a cached copy of that page.

ais523:

26-04-2009 14:24:10 UTC

Yep, I had to hard-refresh that page specifically; hard-refreshing the main BlogNomic page didn’t work. In order to help IRC get active again, could you use a cache-clearing trick? (One way is to replace the URL in the sidebar from <http://blognomic.com/irc/scrape.html> to <http://blognomic.com/irc/scrape.html#1>; then you can increase the number after the # each time you need to do a global cache-clear. That should only be necessary when you change the scraping mechanism itself, if the caching rules are set correctly.)

Kevan: he/him

26-04-2009 14:35:42 UTC

Do you mean “?1” - I didn’t think a hash would force a reload. Have added it as a question mark, anyway.

ais523:

26-04-2009 17:41:46 UTC

Yep, I meant with a question mark and wrote the wrong thing. Let’s see who turns up, anyway, I’m getting pretty lonely over in #nomic!