right aligning nicks + nickmode

Franco <[email protected]> Tue, 2 Oct 2012 14:38:29 +0000
Newsgroups gmane.network.irc.irssi.user
Message-ID <20121002143829.GA8581@efikamx>
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