On Sat, Sep 12, 2009 at 12:59 PM, Finne Boonen <hennar(a)gmail.com> wrote:
On Sat, Sep 12, 2009 at 18:27, APseudoUtopia
<apseudoutopia(a)gmail.com> wrote:
Hey list,
I have an IRC bot. I'm integrating the mediawiki RC announcement into
the bot by having it listen on a UDP ip/port, parsing the incoming
message, then announcing it on IRC.
I'm having trouble in the "parsing" part of that. The RC announcement
message sent from MW is very messy, with random numbers and other
characters mixed in. I've been trying to write a regex to group this
into the Username, the edit reason, the page edited, and the URL of
the diff....but I'm having quite a bit of trouble.
I have this in my LocalSettings.php:
$wgRC2UDPAddress = '127.0.0.1';
$wgRC2UDPPort = '1223';
$wgRC2UDPPrefix = 'Wiki: ';
The string sent to the socket is something like:
Wiki: 14[[07To Do14]]4 10
02http://domain.tld/wiki/index.php?diff=230&oldid=201 5* 03Username 5*
(-45) 10Removed IRC line; added something else
aren't those color codes for IRC?
henna/Finne
Ah, I suppose they are. I generally dislike using colors on IRC
because the client I use doesn't manage colors well (And colors aren't
even part of the RFC..
). Anyway, is there any way to strip these color codes out? I didn't
see a configuration value anywhere in the docs for it.
Actually, could someone point to me the file which generates this RC
announcement message, and I can edit it in MW instead of parsing it
with a regex?
Thanks.