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 19 Dec 2010 09:26:15 PM UTC  
 
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 28 Dec 2010 06:43:23 PM UTC, comment #5:

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

Nils G <nils_2>
Project Member
Tue 28 Dec 2010 01:32:40 PM UTC, 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 28 Dec 2010 01:30:26 PM UTC, 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 27 Dec 2010 04:42:34 PM UTC, 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 27 Dec 2010 10:33:43 AM UTC, 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 19 Dec 2010 09:26:15 PM UTC, 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_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", "");

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):
   
   
Comment:
   

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 06 Jan 2011 09:51:42 PM UTCflashcodeStatusWorks For Me=>Confirmed
      Release1.1-dev=>0.3.3
    Mon 27 Dec 2010 10:33:43 AM UTCflashcodeItem GroupNone=>display
      StatusNone=>Works For Me
      Assigned toNone=>flashcode

    Back to the top


    Powered by Savane 3.1-cleanup