summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Freed2016-09-13 03:32:53 -0400
committerGitHub2016-09-13 03:32:53 -0400
commit16e5f47ff43100ec6d08ebac88028725b848d85e (patch)
tree861da4f82e632bd174e940ff0be967f26611a18b
parent1b036a570d39dde77905ae8f11f4c48e36b95130 (diff)
downloadscripts.irssi.org-16e5f47ff43100ec6d08ebac88028725b848d85e.tar.bz2
CAP printing script
Prints CAP lines sent from the server. Code stolen from cap_sasl.pl
-rw-r--r--scripts/cap.pl33
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/cap.pl b/scripts/cap.pl
new file mode 100644
index 0000000..794b4dc
--- /dev/null
+++ b/scripts/cap.pl
@@ -0,0 +1,33 @@
+use strict;
+use Irssi;
+use vars qw($VERSION %IRSSI);
+
+$VERSION = "1.0";
+%IRSSI = (
+ authors => 'dwfreed',
+ contact => 'dwfreed@mtu.edu',
+ name => 'cap',
+ description => 'Prints caps; derived from cap_sasl.pl by Michael Tharp (gxti), Jilles Tjoelker (jilles), and Mantas Mikulėnas (grawity)',
+ license => 'GPLv2',
+ url => 'none yet',
+);
+
+sub event_cap {
+ my ($server, $args, $nick, $address) = @_;
+ my ($subcmd, $caps);
+
+ if ($args =~ /^\S+ (\S+) :(.*)$/) {
+ $subcmd = uc $1;
+ $caps = ' '.$2.' ';
+ if ($subcmd eq 'LS') {
+ $server->print('', "CLICAP: supported by server:$caps");
+ } elsif ($subcmd eq 'ACK') {
+ $server->print('', "CLICAP: now enabled:$caps");
+ } elsif ($subcmd eq 'NAK') {
+ $server->print('', "CLICAP: refused:$caps");
+ } elsif ($subcmd eq 'LIST') {
+ $server->print('', "CLICAP: currently enabled:$caps");
+ }
+ }
+}
+Irssi::signal_add('event cap', \&event_cap);