# # dynamic-nick.pl — sets the irssi default nick to `| at startup, # so the same dotfiles give each machine its own distinctive nick without # having to hand-edit the config per host. # # Drops into ~/.irssi/scripts/autorun/, loads on irssi start. # use strict; use warnings; use vars qw($VERSION %IRSSI); use Irssi; use Sys::Hostname qw(hostname); $VERSION = '0.1'; %IRSSI = ( authors => 'dissimulo', contact => 'connect+gitea@dustin-williams.com', name => 'dynamic-nick', description => 'Set the default nick to `| at startup.', license => 'MIT', ); sub set_dynamic_nick { my $host = hostname(); # trim anything past the first dot — some systems return FQDNs, which # are longer than most IRCd nick limits (typically 16–30 chars). $host =~ s/\..*$//; my $nick = '`|' . $host; Irssi::command("^set nick $nick"); Irssi::print("dynamic-nick: default nick set to $nick", MSGLEVEL_CLIENTCRAP); } set_dynamic_nick();