From bb5d73900d48c9d5da071ee534ecc4dcfb2c8bf6 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Wed, 13 Oct 2010 02:10:21 +0100 Subject: added documentation, debug setting: 'scrollminder_debug', partially updated to use uberprompt --- scrolled-reminder/scrolled_reminder.pl | 87 ++++++++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 14 deletions(-) (limited to 'scrolled-reminder') diff --git a/scrolled-reminder/scrolled_reminder.pl b/scrolled-reminder/scrolled_reminder.pl index b69e3df..113e2a3 100644 --- a/scrolled-reminder/scrolled_reminder.pl +++ b/scrolled-reminder/scrolled_reminder.pl @@ -1,3 +1,58 @@ +# ABOUT: +# +# This script attempts to prevent you from responding accidentally to long-finished +# conversations if you have scrolled back and are not viewing the current activity +# of the channel. +# +# If you attempt to send a message when you are not at the most recent point in the +# channel buffer, it will intercept the message and offer you a menu of options +# instead. +# +# USAGE: +# +# When scrolled up and sending a message, the subsequent prompt has the following +# options: +# +# * Ctrl-C - cancel sending the message. It remains in your input line, but is not +# sent to the channel. +# * Ctrl-K - send the message to the channel. The input line is cleared. +# * Space - Jump to the bottom (most recent) part of the channel buffer. +# Unlike the first two, this does not cancel the prompt, so it allows +# you to determine if your message is still appropriate before sending. +# +# +# INSTALL: +# +# This script requires that you have first installed and loaded 'uberprompt.pl' +# Uberprompt can be downloaded from: +# +# http://github.com/shabble/irssi-scripts/raw/master/prompt_info/uberprompt.pl +# +# and follow the instructions at the top of that file for installation. +# +# LICENCE: +# +# Copyright (c) 2010 Tom Feist +# +# 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. +# + use strict; use warnings; @@ -7,16 +62,8 @@ use Irssi::Irc; use Data::Dumper; -# Everyone is permitted to copy and distribute verbatim or modified -# copies of this license document, and changing it is allowed as long -# as the name is changed. - -# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE -# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -# 0. You just DO WHAT THE FUCK YOU WANT TO. - -sub DEBUG () { 1 } +my $DEBUG_ENABLED = 0; +sub DEBUG () { $DEBUG_ENABLED } our $VERSION = '0.01'; our %IRSSI = @@ -27,8 +74,8 @@ our %IRSSI = description => 'Requires confirmation to messages sent' . 'when the current window is scrolled up', - license => 'WTFPL; http://sam.zoy.org/wtfpl/', - url => 'http://github.com/shabble/shab-irssi-scripts/' + license => 'MIT', + url => 'http://github.com/shabble/irssi-scripts/' . 'tree/master/scrolled-reminder/', ); @@ -44,8 +91,8 @@ sub script_is_loaded { return $retval; } -unless (script_is_loaded('prompt_info')) { - die "This script requires 'prompt_info' in order to work. " +unless (script_is_loaded('uberprompt')) { + die "This script requires the 'uberprompt.pl' script in order to work. " . "Please load it and try again"; } else { scroll_reminder_init(); @@ -56,11 +103,23 @@ my $pending_input = {}; my $active; sub scroll_reminder_init { + + $permit_pending = 0; $active = 0; + + Irssi::settings_add_bool('scrollminder', 'scrollminder_debug', 0); + # we need to be first so we can intercept stuff. Irssi::signal_add_first('send text', \&handle_send_text); Irssi::signal_add_first('gui key pressed', \&handle_keypress); + Irssi::signal_add('setup changed' => \&setup_changed); + + setup_changed(); +} + +sub setup_changed { + $DEBUG_ENABLED = Irssi::settings_get_bool('scrollminder_debug'); } ################################################################ -- cgit v1.2.3 From 85c2340feb5753d99febcfb06ff0f9d3edda2bae Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Wed, 13 Oct 2010 02:20:44 +0100 Subject: scrollminder now uses uberprompt properly (UP_INNER mode) --- scrolled-reminder/scrolled_reminder.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scrolled-reminder') diff --git a/scrolled-reminder/scrolled_reminder.pl b/scrolled-reminder/scrolled_reminder.pl index 113e2a3..b1deb9c 100644 --- a/scrolled-reminder/scrolled_reminder.pl +++ b/scrolled-reminder/scrolled_reminder.pl @@ -240,5 +240,5 @@ sub set_prompt { my $msg = shift; # add a leading space unless we're trying to clear it entirely. $msg = ' ' . $msg if length $msg; - Irssi::signal_emit('change prompt', $msg); + Irssi::signal_emit('change prompt', $msg, 'UP_INNER'); } -- cgit v1.2.3