Add a New Comment (Rich Markup)
I would prefer to use a constant string as return value.
By the way, same problem could happen with some other modifiers. So a constant string value to discard a modifier string could be added in API, something like WEECHAT_HOOK_MODIFIER_DISCARD.
I understand problem now. It happens with /help because this command prints some empty lines. When your modifier returns same string as given string, it will be considered as "non modified" (even if it's empty string). That explains why empty lines can't be removed. Only way to fix that would be a string with special value to remove it from display, but which value? It should be something not used in strings (for example string with one char, like "\x01" ?) Do you have better suggestions?
I already tested with another instance of weechat. Here is the output (latest git). After installing the script "test" i did a /help and got two empty lines. I also changed some weechat options, always with same result. 17:22:32 | Installierte "perl" Skripten: 17:22:32 | (keine) 17:22:35 | 17:22:35 | Installierte "python" Skripten: 17:22:35 | (keine) 17:22:41 | 17:22:41 | Installierte "lua" Skripten: 17:22:41 | (keine) 17:22:48 | 17:22:48 | Installierte "tcl" Skripten: 17:22:48 | (keine) 17:23:05 | 17:23:05 | Installierte "ruby" Skripten: 17:23:05 | (keine) 17:23:11 | python: Lade das Skript "/home/nils/weechat-git/.weechat_blank/python/test.py" 17:23:11 | python: registriertes Skript "test", Version 0.0.1 (test me) 17:23:17 | 17:23:17 |
It's working for me, with both scripts (python and perl). Can you try to run weechat in another directory (with --dir) and load only one of these scripts? (maybe you have another script modifying string that interacts with this one)
How to reproduce: - load one of the scripts - type for example: /help - output: 22:11:54 | perl: registered script "test", Version 0.01 (do nothing...) 22:11:57 | 22:11:57 | SCRIPT_NAME = "test" SCRIPT_AUTHOR = "bla" SCRIPT_VERSION = "0.0.1" SCRIPT_LICENSE = "GPL3" SCRIPT_DESC = "test me" import weechat def my_modifier_cb(data, modifier, modifier_data, string): return "" weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", "") weechat.hook_modifier("weechat_print", "my_modifier_cb", "") my $SCRIPT = "test"; my $AUTHOR = "blafasel"; my $Version = "0.01"; my $LICENCE = "GPL3"; my $DESCRIPTION = "do nothing..."; use strict; weechat::register( $SCRIPT, $AUTHOR, $Version, $LICENCE, $DESCRIPTION, "", "" ); sub my_modifier_cb { my (undef, $signal, undef, $data) = @_; return ""; } weechat::hook_modifier("weechat_print", "my_modifier_cb", "");
(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)
Attach Files: Comment:
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Only logged-in users can vote.
Please enter the title of George Orwell's famous dystopian book (it's a date):
Follow 5 latest changes.
Copyright © 2023 Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. The Levitating, Meditating, Flute-playing Gnu logo is a GNU GPL'ed image provided by the Nevrax Design Team. Source Code
Powered by Savane 3.11