bugWeeChat - Bugs: bug #31932, hook_modifier(weechat_print) does...


bug #31932: hook_modifier(weechat_print) does not discard each message if you return empty string

Submitted by:  Nils G <nils_2>
Submitted on:  Sun Dec 19 21:26:15 2010  
Category: script API pluginsSeverity: 3 - Normal
Item Group: displayStatus: Confirmed
Privacy: PublicAssigned to: Sebastien Helleu <flashcode>
Originator Name: Open/Closed: Open
Release: 0.3.3IRC nick: nils_2

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Tue Dec 28 18:43:23 2010, comment #5:

I would prefer to use a constant string as return value.

Nils G <nils_2>
Project Member
Tue Dec 28 13:32:40 2010, comment #4:

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.

Sebastien Helleu <flashcode>
Project AdministratorIn charge of this item.
Tue Dec 28 13:30:26 2010, comment #3:

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?

Sebastien Helleu <flashcode>
Project AdministratorIn charge of this item.
Mon Dec 27 16:42:34 2010, comment #2:

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 |

Nils G <nils_2>
Project Member
Mon Dec 27 10:33:43 2010, comment #1:

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)

Sebastien Helleu <flashcode>
Project AdministratorIn charge of this item.
Sun Dec 19 21:26:15 2010, original submission:

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_DESC = "test me"

import weechat

def my_modifier_cb(data, modifier, modifier_data, string):
return ""


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", "");

Nils G <nils_2>
Project Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by flashcode (Posted a comment)
  • -unavailable- added by nils_2 (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    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.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Jan 6 21:51:42 2011flashcodeStatusWorks For Me=>Confirmed
    Mon Dec 27 10:33:43 2010flashcodeItem GroupNone=>display
      StatusNone=>Works For Me
      Assigned toNone=>flashcode

    Back to the top

    Powered by Savane 3.1-cleanup1