Discussion:
right aligning nicks + nickmode
Franco
2012-10-02 14:38:29 UTC
Permalink
Hello everyone,

I have recently begun to use irssi as my irc client and I am currently
customising it suit my needs.
In the 'scripts' section of irssi.org I have found a scrip which right
aligns nick so they look like

< Bob> csacs
< Alice> cscsc
< Yi> csadcd

instead of

<Bob> csacs
<Alice> cscsc
<Yi> csadcd

The script's name is nm.pl.

-----------------------------

My problem with this script is that nickmodes are shown on the right of the
nicks

< Bob > csacs
< Alice@> cscsc
< Yi > csadcd

while I would prefer it on the left side of it, like

< Bob> csacs
<@Alice> cscsc
< Yi> csadcd


I decided to take a look at the code to see if I could tweak it. It seems
some relevant lines are

203 my $length = $sign . $longestNick;
207 Irssi::command('^format pubmsg_me {pubmsgmenick $2 {menick $['.$length.']0}}$1');

( very similar to the example in the tips section irssi's site http://www.irssi.org/documentation/tips )

My problem is that I don't know Perl very well (I don't know Per at all to be
honest). I tried to modify a line like this:

Irssi::command('^format own_msg {ownmsgnick $['.($length+$0.graph).']2 {ownnick $0}}$1');


But irssi complains about the .graph function. I basically (and quite
obviously need the length of $0 to 'push' $2 (the nickmode symbol) appropriately,
bu alas I do not how.

Can you help me out? Is there another way to achieve the goal?

Thanks

-Franco
Franco
2012-10-02 16:53:44 UTC
Permalink
It leads to something like this

<@ Bob> csacs
< Alice> cscsc

so the nickmode is far away from the nick. This is what happens when following
the tip on the tips page

-Franco
Post by Franco
The script's name is nm.pl.
My problem with this script is that nickmodes are shown on the
right of the nicks
< Bob > csacs
< Yi > csadcd
while I would prefer it on the left side of it, like
< Bob> csacs
< Yi> csadcd
doesn't /set neat_right_mode OFF work?
--
Peder Stray
Franco
2012-10-02 19:11:06 UTC
Permalink
Unfortunately that does not work. It displays

<@ Bob>

I think the script is to be read this way:

... {ownmsgnick {ownnick $2 $['.$length.']0}}$1');
^ ^
| |
display |
the '@' |
|
|
display the name,
/after/ adding $length
spaces

If I could write something like

$nickAndmode = $2 + $0

Then I feel

$['.$length.']nickAndMode

would work, but I do not how how to do it in perl/irssi.

Another possible solution would be to shift the whole

{ownnick $2 $0}

but alas, I do not know how to apply the $[-shift]number syntax
to curyly brackets, grrrrrrrrrrr
Post by Franco
It leads to something like this
< Alice> cscsc
so the nickmode is far away from the nick. This is what happens
when following the tip on the tips page
so you want
then i guess you can move the $2 or $3 thats after ']0 on all lines
from ... {ownmsgnick {ownnick $['.$length.']0$2}}$1');
to
... {ownmsgnick {ownnick $2$['.$length.']0}}$1');
and do a /set neat_right_mode ON
--
Peder Stray
Loading...