Home

Awesome

Perl scripts for HexChat (and Xchat)

All of these scripts use the common::sense module which is most likely not included in your Perl. However, it is not required and you can simply change use common::sense; to use v5.20; or whichever your version of Perl is (a few scripts require at least v5.16).
HexChat's documentation describes how you can install modules on Windows.
Some of these scripts might provide a few settings but you'll have to modify the files. Those should be below the use statements and before Xchat::register.

Table of contents:

  1. List of scripts
  2. Remarks
  3. Useful scripts made by others
  4. Other sources for scripts

<a name="list"></a>

autocomplete-no-spaces.pl - Removes the space that is inserted after completing a nick, after a change is detected. You can also add regex rules for when not to remove the space.
channel-mode-prefix.pl - see tab-name.pl
[ n ] colored-nicks.pl - Colors nicknames in more places.
coloured-highlights.pl - see colored-nicks.pl
eval.pl - Evaluates Perl code via /eval and displays the results with Data::Dumper.
file-completition.pl - Completes filenames with Shift-Tab (or just Tab for specified commands).
find-mask.pl - Finds nicks matching a mask in a channel. Usage: /find <mask>
force-specified-colours.pl - Removes all formating from the text events you specify so that your current formatting can be used for the whole event.
hide-whois-end.pl - Hides whois end messages.
identifier.pl (see remarks) - Automatically ghosts, changes nick and identifies with NickServ.
key-code.pl - Displays the key code of the next key press.
light-ignore.pl (see remarks) - A lighter version of /ignore. Messages from users ignored by this script will show up in the server tab.
linebreak.pl - Inserts an invisible line break by pressing Shift-Enter.
no-alert-on-pm.pl - Disables alerts for specified nicks.
notice2server.pl - Forces notices from some nicks to be displayed in the server tab.
one-instance.pl Only allows one instance of HexChat running and brings the existing instance to front. Requires Win32::Event and is only for Windows as HexChat does this on Linux.
reconnect.pl (unstable) - Reconnects if HexChat doesn't receive a message for a specified amount of time as it will sometimes just wait indefinitely without reconnecting.
send-text.pl - Sends the text in the inputbox to the server without any processing.
server-send-raw.pl - Sends whatever you type in a server tab to the server.
session.pl (see remarks) - Restores your last used networks, channels and nicks.
tab-name.pl (see remarks) - Adds channel modes and an unread messages counter to your tab names.
text-event-regex-replace.pl - Regex substitutions for text events.
u2s.pl - Same deal as with notice2server.pl but for changes in your user mode.
undo-redo.pl - Adds undo and redo functionality to the inputbox.
viewlog.pl - Opens the log file of the currect context. Based on Lian Wan Situ's viewlog script with windows specific fixes.
whois-on-pm.pl - Sends a whois when you get a new private dialog is created.

<sub>Legend: [ u ] - recently updated, [ n ] - new</sub>

<a name="remarks"></a>

Remarks

<a name="identifier"></a>

identifier.pl

Usage:

The default behaviour of HexChat is to send the connect commands in your current tab (or last used one if another network is focused?). It's possible to force commands to be executed in the server tab with a few changes in the script. Expand the $networks variable to something like:

$networks = {
	'cool irc' => { #case sensitive network name, same as one in the network list
		'commands' => [
			'command1',
			'command2 etc.',
		],
	},
};

This script expects a messages from NickServ in order to work properly. If a server is sending non-standard messages you can make the script recognize those, similar to the way above:

$networks = {
	'cool irc' => {
		#preferably, use parts of the message that don't change
		'identify' => qr/\Qmessage sent letting you know that the nickname you're using is registered\E/,

		'accepted' => qr/\Qmessage sent letting you know that your password has been accepted and that you're identified\E/,

		'ghosted'  => qr/\Qmessage sent letting you know that your nick has been ghosted\E/,
	},
};

The way this script works is by not letting HexChat see the 376 (motd end) message until you have been identified or 15s after it is received, provided that no notices have been sent or recognized from NickServ (in case the services are down or the nick is not registered). Not letting HexChat see a motd end message can have side-effects such as lag not being calculated.
Finally, by setting your NickServ password in the password field, you will most likely be unable to connect to servers (or use SASL) that require a password (/pass). If you want this fixed, let me know as I don't know use any of those.

<a name="lignore"></a>

light-ignore.pl

Any users ignored by this script will have their messages and notices stripped of any formatting and placed in the server tab. You will also not be highlighted by these messages.
Usage:

You can customize the way the messages appear in a similar way you do with Text Events.

<a name="session"></a>

session.pl

Usage:

Any changes from the point of loading the script will be saved and restored when you next start HexChat. However, while starting up, any changes won't be saved for about a minute, to give HexChat some time to connect and join channels. You can disable autosaving and use /save and /restore to save and restore the session manually.
Inspired by TingPing's session.py.

<a name="tabname"></a>

tab-name.pl

Changes the names of your tabs by adding more (useful) information to them. Currently you can add your channel mode symbol and the amount of unread messages to the tabs. You can customize the way your tab is named by changing the $format and $format_unread variables.

If aligning is enabled, %; will be turned into spaces when applying the name of the tab. If minimum aligning is enabled the separator will turn into as few spaces as possible so that the same aligning applies to all the channels. Otherwise it will take as many spaces as it can so that it fits the maximum length of the tab. Channels with long names will be stripped of some characters so that all the information specified in the format fit. For example, with minimum alignment you can expect

#channel    |4
#longername |2

while without it will be

#channel          |4
#longername       |2

When you have no unread messages, %u is turned into spaces depending on how many digits the largest unread messages counter. With this you can achieve a nice formatting with the unread counter on the left:

my $format        = ' %u  %c';
my $format_unread = '(%u) %c';

<a name="usefulscripts"></a>

Useful scripts made by others

Scripts made by others that I actually use and find (somewhat) useful.

<a name="othersources"></a>

Other sources for scripts

Github

Other