4
4
#
5
5
# -----------------------------------------------------------------------------
6
6
# 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] >
8
8
#
9
9
# This program is free software; you can redistribute it and/or modify
10
10
# it under the terms of the GNU General Public License as published by
38
38
#
39
39
# -----------------------------------------------------------------------------
40
40
# 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)
41
44
# 2023-06-29: nils_2@libera.#weechat
42
45
# version 1.6:
43
46
# FIX: nick was not correctly parsed when message has tags.
129
132
130
133
my $SCRIPT = ' query_blocker' ;
131
134
my $AUTHOR =
' rettub <[email protected] >' ;
132
- my $VERSION = ' 1.6 ' ;
135
+ my $VERSION = ' 1.7 ' ;
133
136
my $LICENSE = ' GPL3' ;
134
137
my $DESCRIPTION = ' Simple blocker for private message (i.e. spam)' ;
135
138
my $COMMAND = " query_blocker" ; # new command name
149
152
" open_on_startup" => " open $SCRIPT buffer on startup. option msgbuffer has to be set to 'buffer' (default: 'off')" ,
150
153
" 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')" ,
151
154
" 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: '')" ,
152
156
);
153
157
154
158
my $CMD_HELP = <<EO_HELP ;
219
223
" open_on_startup" => " off" ,
220
224
" temporary_mode" => " off" ,
221
225
" ignore_auto_message" => " qb-ignore_auto_message.txt" ,
226
+ " msg_tag" => " " ,
222
227
);
223
228
224
229
my $Last_query_nick = undef ;
@@ -359,13 +364,22 @@ sub print_info {
359
364
$message = " " ;
360
365
}
361
366
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 "
363
368
.irc_nick_find_color($nick ).$nick
364
369
.weechat::color(' reset' )
365
370
." tries to start a query on "
366
371
.irc_nick_find_color($server ).$server
367
372
.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 );
369
383
weechat::print ($buf_pointer ," $prefix_network \t "
370
384
." to allow query: /$COMMAND add "
371
385
.irc_nick_find_color($server ).$server
@@ -380,10 +394,15 @@ sub print_info {
380
394
.irc_nick_find_color($nick ).$nick
381
395
.weechat::color(' reset' )) unless (weechat::config_get_plugin(' show_hint' ) eq ' off' );
382
396
}else {
383
- weechat:: print ( $buf_pointer , irc_nick_find_color($server ).$server ." ."
397
+ my $print_line = irc_nick_find_color($server ).$server ." ."
384
398
.irc_nick_find_color($nick ).$nick ." \t "
385
399
.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 );
387
406
}
388
407
return $buf_pointer ;
389
408
}
@@ -783,6 +802,7 @@ sub query_blocker_buffer_open
783
802
weechat::buffer_set($query_blocker_buffer , " notify" , " 0" );
784
803
}elsif (weechat::config_get_plugin(" hotlist_show" ) eq " on" ){
785
804
weechat::buffer_set($query_blocker_buffer , " notify" , " 3" );
805
+ # weechat::buffer_set($query_blocker_buffer, "hotlist", "WEECHAT_HOTLIST_HIGHLIGHT");
786
806
}
787
807
weechat::buffer_set($query_blocker_buffer , " title" , $SCRIPT );
788
808
# logger
0 commit comments