44#
55# -----------------------------------------------------------------------------
66# Copyright (c) 2009-2014 by rettub <[email protected] >7- # Copyright (c) 2011-2022 by nils_2 <[email protected] >7+ # Copyright (c) 2011-2025 by nils_2 <[email protected] >88#
99# This program is free software; you can redistribute it and/or modify
1010# it under the terms of the GNU General Public License as published by
3838#
3939# -----------------------------------------------------------------------------
4040# History:
41+ # 2025-03-02: nils_2@libera.#weechat
42+ # version 1.7:
43+ # ADD: use of print_date_tags to set an tag for query_blocker messages, new option msg_tag (idea PeGaSuS)
4144# 2023-06-29: nils_2@libera.#weechat
4245# version 1.6:
4346# FIX: nick was not correctly parsed when message has tags.
129132
130133my $SCRIPT = ' query_blocker' ;
131134my $AUTHOR =
' rettub <[email protected] >' ;
132- my $VERSION = ' 1.6 ' ;
135+ my $VERSION = ' 1.7 ' ;
133136my $LICENSE = ' GPL3' ;
134137my $DESCRIPTION = ' Simple blocker for private message (i.e. spam)' ;
135138my $COMMAND = " query_blocker" ; # new command name
149152 " open_on_startup" => " open $SCRIPT buffer on startup. option msgbuffer has to be set to 'buffer' (default: 'off')" ,
150153 " temporary_mode" => " if 'on' you have to manually add a nick to whitelist. otherwise a conversation will be temporary only and after closing query buffer the nick will be discard (default: 'off')" ,
151154 " ignore_auto_message" => " path/file-name to store/read nicks to not send an auto message (default: qb-ignore_auto_message.txt)" ,
155+ " msg_tag" => " set a tag for query_blocker messages to filter or trigger messages (default: '')" ,
152156);
153157
154158my $CMD_HELP = <<EO_HELP ;
219223 " open_on_startup" => " off" ,
220224 " temporary_mode" => " off" ,
221225 " ignore_auto_message" => " qb-ignore_auto_message.txt" ,
226+ " msg_tag" => " " ,
222227);
223228
224229my $Last_query_nick = undef ;
@@ -359,13 +364,22 @@ sub print_info {
359364 $message = " " ;
360365 }
361366 unless ( exists $Blocked {$server ." ." .$nick } and lc (weechat::config_get_plugin(' show_first_message_only' ) eq ' off' ) ) {
362- weechat:: print ( $buf_pointer , " $prefix_network \t "
367+ my $print_line = " $prefix_network \t "
363368 .irc_nick_find_color($nick ).$nick
364369 .weechat::color(' reset' )
365370 ." tries to start a query on "
366371 .irc_nick_find_color($server ).$server
367372 .weechat::color(' reset' )
368- .$message );
373+ .$message ;
374+ weechat::print_date_tags($buf_pointer ,0,weechat::config_get_plugin(' msg_tag' ),$print_line );
375+
376+ # weechat::print($buf_pointer,"$prefix_network\t"
377+ # .irc_nick_find_color($nick).$nick
378+ # .weechat::color('reset')
379+ # ." tries to start a query on "
380+ # .irc_nick_find_color($server).$server
381+ # .weechat::color('reset')
382+ # .$message );
369383 weechat::print ($buf_pointer ," $prefix_network \t "
370384 ." to allow query: /$COMMAND add "
371385 .irc_nick_find_color($server ).$server
@@ -380,10 +394,15 @@ sub print_info {
380394 .irc_nick_find_color($nick ).$nick
381395 .weechat::color(' reset' )) unless (weechat::config_get_plugin(' show_hint' ) eq ' off' );
382396 }else {
383- weechat:: print ( $buf_pointer , irc_nick_find_color($server ).$server ." ."
397+ my $print_line = irc_nick_find_color($server ).$server ." ."
384398 .irc_nick_find_color($nick ).$nick ." \t "
385399 .weechat::color(' reset' )
386- .$orig_message );
400+ .$orig_message ;
401+ weechat::print_date_tags($buf_pointer ,0,weechat::config_get_plugin(' msg_tag' ),$print_line );
402+ # weechat::print($buf_pointer,irc_nick_find_color($server).$server."."
403+ # .irc_nick_find_color($nick).$nick."\t"
404+ # .weechat::color('reset')
405+ # .$orig_message );
387406 }
388407 return $buf_pointer ;
389408}
@@ -783,6 +802,7 @@ sub query_blocker_buffer_open
783802 weechat::buffer_set($query_blocker_buffer , " notify" , " 0" );
784803 }elsif (weechat::config_get_plugin(" hotlist_show" ) eq " on" ){
785804 weechat::buffer_set($query_blocker_buffer , " notify" , " 3" );
805+ # weechat::buffer_set($query_blocker_buffer, "hotlist", "WEECHAT_HOTLIST_HIGHLIGHT");
786806 }
787807 weechat::buffer_set($query_blocker_buffer , " title" , $SCRIPT );
788808 # logger
0 commit comments