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 – Buffers Bar Whitelist

2015-09-17-201638_117x768_scrot

Yesterday, I decided to unmerge the servers buffers from the core. Why? Because it is a lot easier on the eyes. Anyway, I use the mouse with WeeChat so I do not have to alt+j # to change buffer. The only thing I will miss is the CTRL+x to switch between merged buffer.

In the following image, the left side is merged with core and the right side is not merged (independant):

beforeafter

Then, I looked up at the options and found an interesting one, the whitelist.

The whitelist

The whitelist allow you to set a different color scheme for certain buffers. The idea that came to my mind was “it would be nice to set a backgroup color for the core and the servers”. Well there is an option named

buffers.color.none_channel_bg

This option will put the specified color as the background color of the core, the servers, the plugins (highmon,chanmon…). The problem with this option is that the background color you want will be removed whenever a low, private, message or highlight is received. You will need to click the name of the server then it will be back to the desired color. The solution? You put the name of the core and all servers in the following option:

buffers.look.whitelist_buffers

Mine looks like this:

/set buffers.look.whitelist_buffers "server.UnderNet,server.TripSit,server.OFTC,server.NetChat,server.freenode,server.EFNet,server.DivinityCoding,server.DaIRC,server.BitlBee"

then you need to put the desired color in these options:

/set buffers.color.whitelist_default_bg 31
/set buffers.color.whitelist_highlight_bg 31
/set buffers.color.whitelist_low_bg 31
/set buffers.color.whitelist_message_bg 31
/set buffers.color.whitelist_private_bg 31

For the foreground colors I could have kept the defaults, or the same values as I chose for the main scheme. But I decided to adjust the colors to fit the background color.

here is my main scheme

/set buffers.color.hotlist_message_fg 229
/set buffers.color.hotlist_private_fg 121
/set buffers.color.hotlist_highlight_fg 163

and here is my whitelist scheme

/set buffers.color.whitelist_highlight_fg 198
/set buffers.color.whitelist_message_fg 221
/set buffers.color.whitelist_private_fg 83

The following options:

/set buffers.color.current_fg 31
/set buffers.color.current_bg white

set the colors for the current buffer no matters the scheme.

Now I like my buffers bar 🙂