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.

Leave a Reply