+Mon Mar 25 17:19:46 EET 2002 Pekka Riikonen <priikone@silcnet.org>
+
+ * Merged bugfixes for Irssi SILC client from irssi.org CVS.
+
Sun Mar 24 11:21:04 EET 2002 Pekka Riikonen <priikone@silcnet.org>
* Added `type' argument to silc_id_payload_parse_id function which
check_replaces - Check word replaces
(Misc)
+ nothing - use this to disable a built-in key
refresh_screen
yank_from_cutbuffer - "Undelete" line
transpose_characters - Swap current and previous character
Lists the channel names. Trying to list all the channel
names usually causes you to be disconnected from the
-server with the reason "Excessive flood".
+server with the reason "Excess flood", as usually all
+40000 channels form together and server naively attempts
+to send you them.
-See also:
+Thus, on IRCNet, you should rather use service ALIS
+(Advanced Listing Service), which will allow you to query
+for channel with specific name, topic, mode or usercount.
+Type /SQUERY ALIS HELP to get more info about it.
+
+See also: SQUERY
--- /dev/null
+
+@SYNTAX:script@
+
+Irssi has very powerful support for scripts written in Perl - they can extend functionality of Irssi in almost unlimited way, and they still keep the client's core unbloated, light and fast. You can control loading and execution of such scripts by this command.
+
+Without any parameters, /SCRIPT acts in same way as if you would call /SCRIPT LIST.
+
+/SCRIPT LIST displays list of all currently loaded scripts, together with full path to their source files.
+
+/SCRIPT EXEC executes the <commands> as a little perl script. It doesn't preserve it loaded in memory, unless -permanent is specified.
+
+/SCRIPT LOAD loads the <script> in memory and executes it.
+
+/SCRIPT UNLOAD unloads the <script> from memory.
+
+/SCRIPT RESET unloads all loaded scripts and resets the perl interpreter.
+
+See also: LOAD, UNLOAD
+
/* Topic of active channel (or address of queried nick) */
static char *expando_topic(SERVER_REC *server, void *item, int *free_ret)
{
- return IS_CHANNEL(item) ? CHANNEL(item)->topic :
- IS_QUERY(item) ? QUERY(item)->address : "";
+ if (IS_CHANNEL(item))
+ return CHANNEL(item)->topic;
+ if (IS_QUERY(item)) {
+ QUERY_REC *query = QUERY(item);
+
+ if (query->server_tag == NULL)
+ return "";
+
+ *free_ret = TRUE;
+ return query->address == NULL ?
+ g_strdup_printf("(%s)", query->server_tag) :
+ g_strdup_printf("%s (%s)", query->address,
+ query->server_tag);
+ }
+ return "";
}
/* Server tag */
static int commands_equal(COMMAND_REC *rec, COMMAND_REC *rec2)
{
+ int i;
+
if (rec->category == NULL && rec2->category != NULL)
return -1;
if (rec2->category == NULL && rec->category != NULL)
return 1;
+ if (rec->category != NULL && rec2->category != NULL) {
+ i = strcmp(rec->category, rec2->category);
+ if (i != 0)
+ return i;
+ }
return strcmp(rec->cmd, rec2->cmd);
}
const char *target)
{
LOG_REC *log;
- char *fname, *dir, *fixed_target;
+ char *fname, *dir, *fixed_target, *params;
log = logs_find_item(LOG_ITEM_TARGET, target, server_tag, NULL);
if (log != NULL && !log->failed) {
if (CHAT_PROTOCOL(server)->case_insensitive)
g_strdown(fixed_target);
- fname = parse_special_string(autolog_path, server, NULL,
- fixed_target, NULL, 0);
+ /* $0 = target, $1 = server tag */
+ params = g_strconcat(fixed_target, " ", server_tag, NULL);
g_free(fixed_target);
+ fname = parse_special_string(autolog_path, server, NULL,
+ params, NULL, 0);
+ g_free(params);
+
if (log_find(fname) == NULL) {
log = log_create_rec(fname, autolog_level);
if (!settings_get_bool("autolog_colors"))
g_strfreev(list);
}
+static void sig_nothing(const char *data)
+{
+}
+
static void cmd_show_keys(const char *searchkey, int full)
{
GSList *info, *key;
key_bind("command", "Run any IRC command", NULL, NULL, (SIGNAL_FUNC) sig_command);
key_bind("key", "Specify name for key binding", NULL, NULL, (SIGNAL_FUNC) sig_key);
key_bind("multi", "Run multiple commands", NULL, NULL, (SIGNAL_FUNC) sig_multi);
+ key_bind("nothing", "Do nothing", NULL, NULL, (SIGNAL_FUNC) sig_nothing);
/* read the keyboard config when all key binds are known */
signal_add("irssi init read settings", (SIGNAL_FUNC) read_keyboard_config);
{
GUI_ENTRY_REC *rec;
- rec = g_hash_table_lookup(input_entries, item->bar);
+ rec = g_hash_table_lookup(input_entries, item->bar->config->name);
if (rec == NULL) {
rec = gui_entry_create(item->xpos, item->bar->real_ypos,
item->size, term_type == TERM_TYPE_UTF8);
gui_entry_set_active(rec);
- g_hash_table_insert(input_entries, item->bar, rec);
+ g_hash_table_insert(input_entries,
+ g_strdup(item->bar->config->name), rec);
}
if (get_size_only) {
gui_entry_redraw(rec); /* FIXME: this is only necessary with ^L.. */
}
-static void sig_statusbar_destroyed(STATUSBAR_REC *bar)
-{
- GUI_ENTRY_REC *rec;
-
- rec = g_hash_table_lookup(input_entries, bar);
- if (rec != NULL) {
- gui_entry_destroy(rec);
- g_hash_table_remove(input_entries, bar);
- }
-}
-
static void read_settings(void)
{
if (active_entry != NULL)
lag_timeout_tag = g_timeout_add(5000, (GSourceFunc) sig_lag_timeout, NULL);
/* input */
- input_entries = g_hash_table_new((GHashFunc) g_direct_hash,
- (GCompareFunc) g_direct_equal);
- signal_add("statusbar destroyed", (SIGNAL_FUNC) sig_statusbar_destroyed);
+ input_entries = g_hash_table_new((GHashFunc) g_str_hash,
+ (GCompareFunc) g_str_equal);
read_settings();
signal_add_last("setup changed", (SIGNAL_FUNC) read_settings);
g_source_remove(lag_timeout_tag);
/* input */
- signal_remove("statusbar destroyed", (SIGNAL_FUNC) sig_statusbar_destroyed);
- g_hash_table_destroy(input_entries);
+ g_hash_table_foreach(input_entries, (GHFunc) g_free, NULL);
+ g_hash_table_destroy(input_entries);
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
}
void term_deinit(void)
{
if (current_term != NULL) {
+ signal(SIGCONT, SIG_DFL);
g_source_remove(redraw_tag);
term_common_deinit();
#include "gui-windows.h"
#include "textbuffer-reformat.h"
-/* SYNTAX: CLEAR */
+/* SYNTAX: CLEAR [-all] [<refnum>] */
static void cmd_clear(const char *data)
{
+ WINDOW_REC *window;
GHashTable *optlist;
+ char *refnum;
void *free_arg;
GSList *tmp;
g_return_if_fail(data != NULL);
- if (!cmd_get_params(data, &free_arg, PARAM_FLAG_OPTIONS,
- "clear", &optlist)) return;
+ if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
+ "clear", &optlist, &refnum)) return;
- if (g_hash_table_lookup(optlist, "all") == NULL) {
- /* clear active window */
- textbuffer_view_clear(WINDOW_GUI(active_win)->view);
- } else {
+ if (g_hash_table_lookup(optlist, "all") != NULL) {
/* clear all windows */
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
WINDOW_REC *window = tmp->data;
textbuffer_view_clear(WINDOW_GUI(window)->view);
}
+ } else if (*refnum != '\0') {
+ /* clear specified window */
+ window = window_find_refnum(atoi(refnum));
+ if (window != NULL)
+ textbuffer_view_clear(WINDOW_GUI(window)->view);
+ } else {
+ /* clear active window */
+ textbuffer_view_clear(WINDOW_GUI(active_win)->view);
}
cmd_params_free(free_arg);
package Irssi;
use strict;
+use Carp;
use vars qw($VERSION $in_irssi @ISA @EXPORT @EXPORT_OK);
+# TIEHANDLE methods
+
+sub TIEHANDLE {
+ my ($class, $level, $object, $target) = @_;
+ return bless [ $level, $object, $target ], $class;
+}
+
+sub WRITE {
+ croak "Cannot syswrite() to an Irssi handle"
+}
+
+sub PRINT {
+ my ($self, @list) = @_;
+ if (defined $self->[1]) {
+ if (defined $self->[2]) {
+ $self->[1]->print($self->[2], join('', @list), $self->[0]);
+ } else {
+ $self->[1]->print(join('', @list), $self->[0]);
+ }
+ } else {
+ Irssi::print(join('', @list), $self->[0]);
+ }
+}
+
+sub PRINTF {
+ my ($self, $format, @list) = @_;
+ if (defined $self->[1]) {
+ if (defined $self->[2]) {
+ $self->[1]->print($self->[2], sprintf($format, @list), $self->[0]);
+ } else {
+ $self->[1]->print(sprintf($format, @list), $self->[0]);
+ }
+ } else {
+ Irssi::print(sprintf($format, @list), $self->[0]);
+ }
+}
+
+sub READ {
+ croak "Cannot [sys]read() from an Irssi handle"
+}
+
+sub READLINE {
+ croak "Cannot readline() from an Irssi handle"
+}
+
+sub GETC {
+ croak "Cannot getc() from an Irssi handle"
+}
+
+sub CLOSE {}
+sub UNTIE {}
+sub DESTROY {}
+
+# End of TIEHANDLE methods
+
+# Handle creators
+
+sub create_window_handle {
+ my ($object, $level) = @_;
+ $object = eval 'active_win' unless defined $object;
+ $level = eval 'MSGLEVEL_CLIENTCRAP' unless defined $level;
+ croak 'Usage: create_window_handle([$window[, $level]])'
+ if ref $object !~ /::Window$/i;
+ no strict 'refs';
+ my $symref = 'Irssi::Handles::' . $object . '/' . $level;
+ my $fh = \*{$symref};
+ tie *{$symref}, __PACKAGE__, $level, $object;
+ return $fh;
+}
+
+sub create_server_handle {
+ my ($object, $target, $level) = @_;
+ croak 'Usage: create_server_handle($server, $target[, $level])'
+ if not defined $object
+ or not defined $target
+ or ref $object !~ /::Server$/i;
+ $level = eval 'MSGLEVEL_CLIENTCRAP' unless defined $level;
+ no strict 'refs';
+ my $symref = 'Irssi::Handles::' . $object . '/' . $target . '/' . $level;
+ my $fh = \*{$symref};
+ tie *{$symref}, __PACKAGE__, $level, $object, $target;
+ return $fh;
+}
+
+# Object interface for create_server_handle
+
+sub Irssi::Server::create_handle {
+ goto &Irssi::create_server_handle;
+}
+
+# Normal Irssi.pm stuff
+
sub VERSION {
my $version = $_[1];
die "This script requires irssi version $version or later"
}
sub EXPORT_ALL () {
+ my %exports = map { $_ => undef } @EXPORT, @EXPORT_OK;
no strict 'refs';
- @EXPORT_OK = grep { /[a-z]/ && defined *{$_}{CODE} } keys %Irssi::;
+ for (keys %Irssi::) {
+ if (/^MSGLEVEL_/) {
+ (my $short = $_) =~ s///;
+ next if exists $exports{"*$short"};
+ tie *{ $short }, __PACKAGE__, &$_();
+ push @EXPORT, "*$short";
+ } else {
+ next if exists $exports{$_};
+ push @EXPORT_OK, $_ if /[a-z]/ && defined *{$_}{CODE};
+ }
+ }
+ select CLIENTCRAP;
}
sub in_irssi {
MSGLEVEL_CLIENTERROR MSGLEVEL_HILIGHT MSGLEVEL_ALL MSGLEVEL_NOHILIGHT
MSGLEVEL_NO_ACT MSGLEVEL_NEVER MSGLEVEL_LASTLOG
);
-@EXPORT_OK = qw();
my $static = 0;
}
1;
-
print_script_errors = 1;
settings_add_str("perl", "perl_use_lib", PERL_USE_LIB);
- PL_perl_destruct_level = 1;
+ /*PL_perl_destruct_level = 1; - this crashes with some people.. */
perl_signals_init();
signal_add_last("script error", (SIGNAL_FUNC) sig_script_error);
require Exporter;
require DynaLoader;
+sub Irssi::UI::Window::create_handle {
+ goto &Irssi::create_window_handle;
+}
+
@ISA = qw(Exporter DynaLoader);
@EXPORT = qw();
@EXPORT_OK = qw();
and how it should be interpreted. Some of the Message Flags may define
additional payloads to be associated with the flag, but the [SILC2] does
not define them. This memo defines the payloads for those Message Flags
-that was marked to include additional payloads in [SILC1].
+that was marked to include additional payloads in [SILC2].
By defining the payloads for the Message Flags the SILC message payloads
can be augmented to support any kind of data, which can be easily