irssi - / игнорировать ник, но сообщения появляются в логах

445
FreyasSpirit

Я хочу / игнорирую ник, и все же его сообщения появляются в моих журналах. В частности, я не хочу знать, что они общаются по каналу в целом, но хочу иметь возможность просматривать журналы, чтобы получить полный контекст, если я слежу за разговором, который не имеет особого смысла.

Я не хочу этого достаточно сильно, чтобы научиться писать новый сценарий, но я способен и желаю изменить существующий сценарий, который соответствует тому, что я хочу, если он существует.

2

1 ответ на вопрос

2
Brenden Carvalho

Was looking for something similar found this,

https://github.com/irssi/scripts.irssi.org/blob/master/scripts/ignore_log.pl

The script will log anything that is set to be ignored.

In case the link goes down, it is referred through https://scripts.irssi.org, and here are the current contents:

#!/usr/bin/perl # ignore_log.pl (ignore_log -- send [some] ignored events to log), Version 0.1 # this script is dedicated to bormann@IRCNET. # # Copyleft (>) 2004 jsn <jason@nichego.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # The complete text of the GNU General Public License can be found # on the World Wide Web: <URL:http://www.gnu.org/licenses/gpl.html> use strict; use Irssi; use POSIX qw/strftime/ ; use vars qw($VERSION %IRSSI); $VERSION = "0.1"; %IRSSI = ( authors => 'Dmitry "jsn" Kim', contact => 'jason@nichego.net', name => 'ignore_log', description => 'script to log ignored messages', license => 'GPL', url => 'http://', changed => '2004-09-10', changes => 'initial version' ); Irssi::print("*****\n* $IRSSI $VERSION loaded."); Irssi::print("* use `/set ignore_log <filename>' to configure") ; Irssi::print("* use `/set ignore_log none' to disable ignore logging") ; sub handle_public { my ($srv, $msg, $nick, $addr, $tgt) = @_; return if lc(Irssi::settings_get_str("ignore_log")) eq "none" ; write_log($nick, $msg, $tgt) if $srv->ignore_check($nick, $addr, $tgt, $msg, MSGLEVEL_PUBLIC) ; } sub handle_private { my ($srv, $msg, $nick, $addr) = @_; return if lc(Irssi::settings_get_str("ignore_log")) eq "none" ; write_log($nick, $msg) if $srv->ignore_check($nick, $addr, "", $msg, MSGLEVEL_MSGS) ; } sub write_log { my ($nick, $msg, $tgt) = @_ ; $tgt ||= "->" ; my ($lfile) = glob Irssi::settings_get_str("ignore_log"); if (open(LF, ">>", $lfile)) { my $ts = strftime("%D %H:%M", localtime()) ; print LF "[$ts] $tgt $nick $msg\n" ; close LF ; } else { Irssi::active_win()->print("can't open file `$lfile': $!") ; } } Irssi::settings_add_str("ignore_log", "ignore_log", "~/.irssi/ignore.log"); Irssi::print("* logging ignored users to `" . Irssi::settings_get_str("ignore_log") . "'") ; Irssi::signal_add_first("message public", "handle_public") ; Irssi::signal_add_first("message private", "handle_private") ; 
Если бы только он мог войти в соответствующий журнал каждого канала, а не в отдельный файл журнала. WasabiFlux 5 лет назад 0

Похожие вопросы