WeeChat – Custom Ignore

The following alias will automatically add the host of the user to the ignore add command. If you precise the bitch argument, you will ignore the user then tell the channel where you issued the command. Of course you don’t use the latter on serious network like Freenode or OFTC. AFAIK this is only used on general network like UnderNet. The default message sent to the channel is the same as the /ignore replies in mIRC. Let’s start!

First, you need the perlexec.pl script :

/script install perlexec.pl

then create the following alias :

/alias add ignore2 /eval /who ${channel};/wait 2s /eval /perlexec my $infolist = weechat::infolist_get("irc_nick", "", q(${server},${channel},$1))\;weechat::infolist_next($infolist)\;my $host = (split("@", weechat::infolist_string($infolist, "host")))[1]\;if (!defined($host)) { weechat::command("", q(/print -core I dont have the host of $1 please try again))\; } else { if (lc(q($2)) eq lc("bitch")) { weechat::command($buffer, q(* Added *!*@) . $host . q( to ignore list))\; } weechat::command("", q(/ignore add *!*@) . $host . q( ${server}))\; } weechat::infolist_free($infolist)\;

Now, if you ignore someone without the bitch argument, you should receive something similar to this in the weechat core buffer:

/ignore2 stupiduser
irc: ignore added:
[8] mask: .*!.*@ip\.ip\.ip\.ip / serverL UnderNet / channel: *

you can unignore the host with

/ignore del 8

if you ignore someone with the bitch argument, you should see this on the channel:

/ignore2 stupiduser bitch
r3m: * Added *!*@ip.ip.ip.ip to ignore list

Now, if you want to be able to ignore people via the nicklist or the chat area, here is how to do it for chat area:

Middle-click on the nickname in the chat area and then press ‘i’ for a ignore or ‘I’ for a bitch ignore.

/key bindctxt cursor @chat(*):i /window ${_window_number};/ignore2 ${_chat_line_nick};/cursor stop
/key bindctxt cursor @chat(*):I /window ${_window_number};/ignore2 ${_chat_line_nick} bitch;/cursor stop

Now for the nicklist:

Middle-click the nickname in the nicklist and then press ‘i’ for a ignore or ‘I’ for a bitch ignore.

/key bindctxt cursor @item(buffer_nicklist):i /window ${_window_number};/ignore2 ${nick};/cursor stop
/key bindctxt cursor @item(buffer_nicklist):I /window ${_window_number};/ignore2 ${nick} bitch;/cursor stop

Voila!

btw: if you are wondering why I put /who ${channel} instead of the nick, read this. Also replace /wait 2s to something higher if you don’t receive the /who reply before /ignore is called. If WeeChat don’t have the host, nothing will happen, except you will receive a message in core buffer telling you to try again.

WeeChat – WeeChat Relay and Let’s Encrypt

I decided to enable the WeeChat Relay plugin. Until now, I only used the ZNC IRC bouncer because it allows me to use any standalone IRC client. Now, I also want to have acces to weechat-android and Glowing-bear so I enabled the Relay plugin.

I decided to obtain a certificate from Let’s Encrypt. It’s free and it’s trusted by all major browser. Let’s Encrypt creates four files:

cert.pem
chain.pem
fullchain.pem
privkey.pem

You must combine privkey.pem and fullchain.pem together. Here is how to setup everything on Debian 8.

First, be sure git is installed:

sudo apt-get install git

Clone the repo:

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt

Exec the script

./letsencrypt-auto certonly --standalone -d domain-you-will-use-to-connect-to-the-relay

Now you need to ‘cd’ to /etc/letsencrypt/live/your-domain. You need to use ‘su’ here.

su
cd /etc/letsencrypt/live/<your-domain>
cat {privkey,fullchain}.pem >> relay.pem
cp relay.pem /home/<login name>/.weechat/ssl/

Now, in WeeChat:

Type this if WeeChat was running when you execute the above commands

/relay sslcertkey

Choose a port

/relay add ssl.weechat <port>

Set a password (insecure)

/set relay.network.password <pass>

You should use the /secure feature when you want to put a password in an option.

Set a master passphrase

/secure passphrase <your pass phrase>

Set your relay passphrase

/secure set relaypass <your pass phrase>

Then

/set relay.network.password ${sec.data.relaypass}

Done. Note that the certificate will be valid for 90 days. The folks recommends to renew the certificate every 60 days.

capture_007_04012016_180412Here is a screenshot of glowing-bear, I’m sad the layout feature seems absent 🙁

WeeChat – hide buffers below servers

output

Today I received a message from a user (Fearful). He was asking if there is a way to hide the buffers below the servers in the buffers bar.

I finally found out a way to achieve this. Here how it works:

You middle-click on an item in the buffers bar. For example the channel #weechat. Then you press ‘h’ to hide channels and privates buffers and keep only the server buffer. So we need to bind something to “middle-click + h” combo:

/key bindctxt cursor @item(buffers):h /command -buffer ${full_name} irc /allchan -current buffer hide;/command -buffer ${full_name} irc /allpv -current buffer hide;/cursor stop

then, to unhide those buffers we will press “middle-click + H (uppercase)”

/key bindctxt cursor @item(buffers):H /command -buffer ${full_name} irc /allchan -current buffer unhide;/command -buffer ${full_name} irc /allpv -current buffer unhide;/cursor stop

To hide all buffers from all servers, middle-click on the weechat core buffer.

You dont even need to unmerge servers buffers from core. It works in both case.

Thanks Fearful for this excellent idea!