Skip to content
Buzzen Chat Network

Xchat [style] Stripper

A TG007 community discussion started by err0r.

Discussion 7 posts
Page 1 of 1
Open
Topic #13290 · 7 published posts · 1,722 views

Thanks to LifeIsPain there is now a snippet to strip the style tags for the users that prefer to chat with xchat on buzzen.

 

Save the following as stripstyle.pl in your xchat profile directory and load it.

use Xchat qw(:all); 
use strict; 
use warnings; 
  
register('Strip Style', '001', 'Strip [style][/style] tags'); 
  
hook_server('PRIVMSG', sub { 
    my $instring = $_[1][0]; 
    my $edited = 0; 
    # using a while loop instead of /g due to embedded styles 
    while ($instring =~ s/\[style [^\]]*\](.*?)\[\/style\]/$1/i) { 
       $edited = 1; 
    } 
    if ($edited) { 
       command('recv '.$instring); 
       return EAT_ALL; 
    } 
    else { 
       return EAT_NONE; 
    } 
});

Get information about ircWx here

glad you got this as i was getting no where fast

Spam Honeypot - http://www.haggistech.co.uk/honey(humans do not register)

yeah perl isn't my thing either lol

Get information about ircWx here

as i said to you i learnt perl as i went along doing the one for cusa lol

 

i should really learn regex i worked out a few thing like ^ is at start

+ mean anything like A+B is A and B and anything in bewteen lol

Spam Honeypot - http://www.haggistech.co.uk/honey(humans do not register)

and $ is the end of string

+ means one or more, as in \w+

for instance...

:P

Edited Aug 19, 2009 8:46 PM by Fanfare

easiest way to learn it from my experience is to use an online regex tool. This is a good web app that is a regex tester, and to the right it has quite a few different options and examples.

 

http://gskinner.com/RegExr/

regex wasn't so much the problem.. i can usually get through any regex that i need.. i just don't know than basic perl or xchat coding.

Get information about ircWx here