aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--auto-server/auto_server.pl15
-rw-r--r--feature-tests/getchan.pl2
-rw-r--r--feature-tests/hide_password.pl129
-rw-r--r--longify/longify-urls.pl7
-rw-r--r--prompt_info/README.pod2
-rw-r--r--prompt_info/uberprompt.pl2
-rw-r--r--quit-notify/notifyquit.pl2
-rw-r--r--tinyurl-tabcomplete/complete-tiny-url.pl2
8 files changed, 145 insertions, 16 deletions
diff --git a/auto-server/auto_server.pl b/auto-server/auto_server.pl
index 0046340..8f24e50 100644
--- a/auto-server/auto_server.pl
+++ b/auto-server/auto_server.pl
@@ -5,21 +5,16 @@
#
# the primary command used is /join+ #channelname
#
-# Mappings for channels to servers is accomplished with the
-# joinplus_server_maps setting.
-#
-# Within this setting, space separated pairs denote channel, server pairs.
-# Spaces also separate individual pairs, for example:
-#
-# /set joinplus_server_maps #foo Freenode #bar irc.somewhere.tld #meep DALNet
+# Mappings for channels and servers are retrieved from irssi's internal
+# /channel list
#
# Then use /join+ #foo, and if you are not already connected to freenode, it
# will connect you, and then join that channel.
# TODO:
-# Autocompletion for channel names
# address conflict resolution
# fix that disgusting race condition
+# Fix incredibly slow shutdown time after a few days
use strict;
use warnings;
@@ -94,7 +89,7 @@ sub haxy_print_hook {
my $data = $_[1];
# Hose control characters
$data =~ s/\x04.//g;
- if ($data =~ m/^#/) {
+ if ($data =~ m/^[#&!]/) {
my @items = split /\s+/, $data;
push(@hack_channels, $items[0]);
push(@hack_channels, $items[1]);
@@ -135,7 +130,7 @@ sub join_plus {
# parse out channel name from args:
my $channel;
- if ($args =~ m/^(#?[#a-zA-Z0-9-]+)/) {
+ if ($args =~ m/^([#&!]?[^ ]*)/) {
$channel = $1;
_debug_print ("Channel is: $channel");
}
diff --git a/feature-tests/getchan.pl b/feature-tests/getchan.pl
index 7d4ee55..acb1748 100644
--- a/feature-tests/getchan.pl
+++ b/feature-tests/getchan.pl
@@ -104,7 +104,7 @@ sub restore_formats {
Irssi::command("^FORMAT chansetup_line $line_format");
Irssi::command("^FORMAT chansetup_header $head_format");
if ($foot_format =~ m/^\s*$/) {
- Irssi::command("^FORMAT -reset chansetup_footer");
+ Irssi::command("^FORMAT -delete chansetup_footer");
} else {
Irssi::command("^FORMAT chansetup_footer $foot_format");
}
diff --git a/feature-tests/hide_password.pl b/feature-tests/hide_password.pl
new file mode 100644
index 0000000..695a985
--- /dev/null
+++ b/feature-tests/hide_password.pl
@@ -0,0 +1,129 @@
+=pod
+
+=head1 NAME
+
+hide_password.pl
+
+=head1 DESCRIPTION
+
+A minimalist template useful for basing actual scripts on.
+
+=head1 INSTALLATION
+
+Copy into your F<~/.irssi/scripts/> directory and load with
+C</SCRIPT LOAD F<filename>>.
+
+=head1 USAGE
+
+None, since it doesn't actually do anything.
+
+=head1 AUTHORS
+
+Copyright E<copy> 2011 Tom Feist C<E<lt>shabble+irssi@metavore.orgE<gt>>
+
+=head1 LICENCE
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+=head1 BUGS
+
+=head1 TODO
+
+Use this template to make an actual script.
+
+=cut
+
+use strict;
+use warnings;
+
+use Irssi;
+use Irssi::Irc;
+use Irssi::TextUI;
+
+use Data::Dumper;
+
+our $VERSION = '0.1';
+our %IRSSI = (
+ authors => 'shabble',
+ contact => 'shabble+irssi@metavore.org',
+ name => '',
+ description => '',
+ license => 'MIT',
+ updated => '$DATE'
+ );
+
+
+my $password_active;
+my $password_buffer;
+
+sub PASSWORD_CHAR () { ord('#') }
+
+sub init {
+ Irssi::command_bind('password', \&cmd_password);
+ $password_active = 0;
+ $password_buffer = '';
+
+}
+
+sub cmd_password {
+
+ # not sure why this delay is needed, but otherwise
+ # setting the input (" Password: ") doesn't work.
+ Irssi::timeout_add_once(10, sub {
+ Irssi::gui_input_set('Password: ');
+ begin_entry_redirect();
+ }, 0);
+}
+
+sub begin_entry_redirect {
+ $password_active = 1;
+ $password_buffer = '';
+
+ Irssi::signal_add_first('gui key pressed', 'sig_key_pressed');
+
+}
+
+sub end_entry_redirect {
+ Irssi::signal_remove('gui key pressed', 'sig_key_pressed');
+ $password_active = 0;
+}
+
+sub password_complete {
+ Irssi::active_win->command("/echo Your password is: $password_buffer");
+ Irssi::gui_input_set('');
+}
+
+sub sig_key_pressed {
+ my ($key) = @_;
+
+ return unless $password_active;
+
+ my $char = chr $key;
+ if ($char =~ m/\r|\n/) {
+ end_entry_redirect();
+ password_complete();
+ Irssi::signal_stop;
+ } else {
+ # TODO: Test if the char is printable, and abort otherwise?
+ $password_buffer .= $char;
+ Irssi::signal_continue(PASSWORD_CHAR);
+ }
+}
+
+init();
diff --git a/longify/longify-urls.pl b/longify/longify-urls.pl
index 38e8ba8..cd36503 100644
--- a/longify/longify-urls.pl
+++ b/longify/longify-urls.pl
@@ -130,7 +130,12 @@ sub _handle_messages {
my $uri_obj = URI->new($url);
- return unless ref($uri_obj) && exists $domains->{$uri_obj->host};
+ # check we've got a valid url
+ return unless ref($uri_obj);
+ return unless $uri_obj->can('host');
+
+ # match against the whitelist.
+ return unless exists $domains->{$uri_obj->host};
$pending_msg_params->{$url} = [@_];
$lookup_in_progress = 1;
diff --git a/prompt_info/README.pod b/prompt_info/README.pod
index d8e3b3e..70dd0b5 100644
--- a/prompt_info/README.pod
+++ b/prompt_info/README.pod
@@ -211,7 +211,7 @@ I<---- start of snippet ---->
}
sub load_uberprompt_failed {
- Irssi::signal_remove('script error', 'load_prompt_failed');
+ Irssi::signal_remove('script error', 'load_uberprompt_failed');
print "Script could not be loaded. Script cannot continue. "
. "Check you have uberprompt.pl installed in your path and "
diff --git a/prompt_info/uberprompt.pl b/prompt_info/uberprompt.pl
index 62bda13..cd64707 100644
--- a/prompt_info/uberprompt.pl
+++ b/prompt_info/uberprompt.pl
@@ -211,7 +211,7 @@ I<---- start of snippet ---->
}
sub load_uberprompt_failed {
- Irssi::signal_remove('script error', 'load_prompt_failed');
+ Irssi::signal_remove('script error', 'load_uberprompt_failed');
print "Script could not be loaded. Script cannot continue. "
. "Check you have uberprompt.pl installed in your path and "
diff --git a/quit-notify/notifyquit.pl b/quit-notify/notifyquit.pl
index 3958a39..1e5032b 100644
--- a/quit-notify/notifyquit.pl
+++ b/quit-notify/notifyquit.pl
@@ -141,7 +141,7 @@ if (script_is_loaded('uberprompt')) {
}
sub load_uberprompt_failed {
- Irssi::signal_remove('script error', 'load_prompt_failed');
+ Irssi::signal_remove('script error', 'load_uberprompt_failed');
print "Script could not be loaded. Script cannot continue. "
. "Check you have uberprompt.pl installed in your scripts directory and "
diff --git a/tinyurl-tabcomplete/complete-tiny-url.pl b/tinyurl-tabcomplete/complete-tiny-url.pl
index b2d448f..ad43c5e 100644
--- a/tinyurl-tabcomplete/complete-tiny-url.pl
+++ b/tinyurl-tabcomplete/complete-tiny-url.pl
@@ -123,7 +123,7 @@ sub match_uri {
if ($text =~ $regex) {
my $uri = $1;
# shorten needs the http prefix or it'll treat it as a relative link.
- $uri = 'http://' . $uri if $uri !~ m(http://);
+ $uri = 'http://' . $uri if $uri !~ m([a-z][\w-]+:(?:/{1,3}|[a-z0-9%]));
return $uri;
} else {
# no match