WeeChat – Ignore

In WeeChat, there are three commands that can be used to hide or ignore messages from specific people:

  • the ignore command
  • the filter command
  • the trigger command

and I found two scripts that hide just the messages, while still showing the chat activity by specified users:

Let’s start!

The ignore command

The ignore command is used to ignore everything from a nick or host on a channel, server or everywhere. The following command for instance would ignore all messages from r3m on channel #defocus on the freenode server:

/ignore add r3m freenode #defocus

Note: the ignored messages are deleted and are not logged. If you only want to hide the messages and still log them, then you should use the /filter command instead.

Note 2: this ignore filter would be very easy to get around though, as the person would only have to change their nickname

You can use the * wildcard to ignore, for example, all nicknames beginning with Guest:

/ignore add Guest*

or use a regex:

/ignore add re:^Guest.*

To list the ignore, type:

/ignore list

then to delete the first entry, type:

/ignore del 1

and to delete all the entry type:

/ignore del -all

The filter command

The filter command is used for two things:

  • hide everything from a user
  • hide everything that matches your specified regular expression

To hide every join/part/quit message everywhere:

/filter add partquit * irc_join,irc_part,irc_quit *

To hide everything from r3m on #defocus:

/filter add r3mdefocus irc.freenode.#defocus nick_r3m *

To hide every line from r3m which contains only ‘lol’ on every channel and server:

/filter add r3mlol * nick_r3m ^lol$

Note: the ^ indicates the beginning of the sentence, and $ indicates the end of the line. In other words, where lol is the only thing in the sentence. Just ^lol would match every sentence that starts with ‘lol’, while lol$ would match every sentence that ends with ‘lol’, whereas just lol would match every sentence that includes ‘lol’.

To list the filters, type:

/filter list

then to delete the first entry, type:

/filter del 1

:and to remove every filter, type:

/filter del -all

The trigger command

The trigger command is very complex and can be used for hundred different things. If you want to ignore everything from nils_2 and FlashCode, use this command (thanks nils_2)
:

/trigger add shut_up modifier 2000|weechat_print "${tg_tags} =~ 
,irc_privmsg,&&,nick_nils_2,|,nick_FlashCode," 
"/.*/${tg_prefix}\t${color:238}text cloaked"

it will replace text from nils_2 and FlashCode with “text cloaked” message.

I will add other examples soon.

The curiousignore.pl script

if you dislike ignoring people because it becomes difficult to follow the discussion, you could use the curiousignore.pl script. This way, you will see the nickname but not the message.

/script install curiousignore.pl
/set plugins.var.perl.curiousignore.blacklist "freenode.#defocus.r3m,freenode.#weechat.Rick18"

The shutup.py script

This script is similar to curiousignore.pl. By default, it replaces the text of the ‘muted’ person with a random line from the Jabberwocky poem. At the time of writing, the shutup.py script is not in the official repository yet. You can however already download it from FiXato’s git repository

mkdir -p ~/.weechat/python && wget https://raw2.github.com/FiXato/weechat_scripts/master/shutup.py -O ~/.weechat/python/shutup.py

and then load it from within WeeChat with:

/script load shutup.py

or you could wait till it has been accepted into WeeChat’s official scripts repo and install it via the script plugin:

/script install shutup.py

Now let’s start:

/set plugins.var.python.shutup.muted_masks @\S+\.aol\.com$:#comcast,#AT&T

This will replace any text from customers of aol in the channels #comcast and #AT&T. To replace any line from any tor users :

/set plugins.var.python.shutup.muted_masks @gateway\/tor-sasl\/

As you can see you can omit the channel to enable replacement everywhere. To replace any text from r3m and FiXato :

/set plugins.var.python.shutup.muted_masks r3m! FiXato!

So you must separate the targets by a space. To replace something with your own custom text :

/set plugins.var.python.shutup.replacement_text :(

will replace the text with a sad smile

I heard that FlashCode is working hard on a new command called ‘trigger’ so this post may become outdated soon. I’ll try to update the post then.

Enjoy!

I’d like to thank FiXato for his help with proofreading my blog posts. If you need some proofreading done, you could try contacting Filip H.F. “FiXato” Slagter.

WeeChat – Monitoring

Today, I decided to create a new layout. My last one was very useful to follow tech news. This one is useful to monitor everything (channels, highlight, clones). Note that the tech layout is still the one I use so I will not change My WeeChat Configuration.

chanmon.pl

This script will create a buffer that will contain the messages of all monitored channels. In my case, the french channels will be monitored.

/script install chanmon.pl
/allchan -exclude=*fr chanmon monitor $channel $server
/window splith 50
/buffer chanmon

clone_scanner.py

As the name suggests, this script will scan the channels on demand and even automatically. Just load the script and it will write the result (in the clone_scanner buffer) as soon as a clone is detected (automatic scan).

/script install clone_scanner.py
/clone_scanner scan (to show up the buffer...)
/window splith 66
/buffer clone_scanner

highmon.pl

This script will create a highmon buffer that will contain the messages that match a highlight.

/script install highmon.pl
/window splith 50
/buffer highmon
/window 1
/layout save monitoring

The result :

2014-01-20-183354_1600x900_scrot

Enjoy!

Weechat – beep

2013-12-05-164314_439x48_scrot

There is a script called beep.pl for WeeChat. It emits a beep when someone sends you a private message, a DCC, or when someone highlights you in a channel. You can also configure the script to execute a command. I was looking for a way to differentiate between private messages, highlights and DCC. I had a discussion with nils_2 and I fell in love with his solution : the beep command. Here is how to achieve this on Debian GNU/Linux.

Install the beep program

sudo aptitude install beep

Install the script

/script install beep.pl

Configure the beeps

/set plugins.var.perl.beep.beep_command_dcc "beep -f 400"
/set plugins.var.perl.beep.beep_command_highlight "beep -f 500"
/set plugins.var.perl.beep.beep_command_pv "beep -f 600"

If you prefer to keep the normal frequency, you could specify how many beeps you want to hear with :

/set plugins.var.perl.beep.beep_command_dcc "beep"
/set plugins.var.perl.beep.beep_command_highlight "beep -r 2"
/set plugins.var.perl.beep.beep_command_pv "beep -r 3"

or the lenght of the beep :

/set plugins.var.perl.beep.beep_command_dcc "beep -l 300"
/set plugins.var.perl.beep.beep_command_highlight "beep -l 600"
/set plugins.var.perl.beep.beep_command_pv "beep -l 900"

If you run WeeChat remotely, write a script remote_beep.sh with the following content :

#!/bin/sh                 
ssh user@host "beep $1 $2"

and save the file. Then, replace beep by remote_beep.sh :

/set plugins.var.perl.beep.beep_command_dcc "remote_beep.sh -f 400"
/set plugins.var.perl.beep.beep_command_highlight "remote_beep.sh -f 500"
/set plugins.var.perl.beep.beep_command_pv "remote_beep.sh -f 600"

Enjoy!