mIRC Homepage
Posted By: pouncer regex help - 26/12/09 12:34 PM
When the server sends me a 353 reply it appears like this. Paul is me, Jonathon is in the room and is voiced. The last letter in the 4 letter code before the nickname, indicates whether the user is voiced or not (V = voiced, N = not voiced).

Quote:

:FlashIrcServer.1 353 Paul = %#!!Roomy :UMNV,Jonathon UMNN,'Paul


I then send a 353 to my localhost socket
Code:
if ($2 == 353) sockwrite -n buzz.avoLocal $1-5 $regsubex($6-, /([^:,\s]+,)/g, )


It sends
Quote:

sockwrite -n buzz.avoLocal :FlashIrcServer.1 353 Paul = %#!!Roomy :Jonathon 'Paul


As you see, it should be sending

sockwrite -n buzz.avoLocal :FlashIrcServer.1 353 Paul = %#!!Roomy :+Jonathon 'Paul

so how could I change the regex to check for the last lettercode V and send a + symbol along with the nickname when i send my 353 to the localhost socket.
Posted By: gooshie Re: regex help *DELETED* - 26/12/09 02:13 PM
Post deleted by gooshie
Posted By: pouncer Re: regex help - 26/12/09 02:20 PM
That works perfectly thanks gooshie. I have a lil problem though, if users are owners and voiced it is sending their nickname like this

+.Jonathon

and so they appear in my nicklist like +.Jonathon whereas they should only appear as .Jonathon because owner has priority over voice in terms of how nicknames are displayed.

is there a way to add the + after the . so its like .+Jonathon (this way Jonathon would still show as owner, and when someone -q's Jonathon he would then show as voiced)
Posted By: Wims Re: regex help - 26/12/09 07:06 PM
Code:
if ($2 == 353) sockwrite -n buzz.avoLocal $1-5 $+(:,$replace($mid($6,5,1),V,+,O,@,H,%),$gettok($6,2,44)) $gettok($7,2,44)
Don't use regex if you don't need them and especially if you don't know them.I've guessed O for op and H for halfop but just change that
Posted By: pouncer Re: regex help - 27/12/09 12:16 AM
Originally Posted By: Wims
Code:
if ($2 == 353) sockwrite -n buzz.avoLocal $1-5 $+(:,$replace($mid($6,5,1),V,+,O,@,H,%),$gettok($6,2,44)) $gettok($7,2,44)
Don't use regex if you don't need them and especially if you don't know them.I've guessed O for op and H for halfop but just change that


Thanks but I have problems with this

Code:
alias rtest {
  var %server_str =  :FlashIrcServer.1 353 Paul = $(%#!!Roomy, ) :UMPV,.Damien UUNV,@Sarah UMNV,@Sid UMNV,.Manny[4]

  tokenize 32 %server_str

  var %output = $1-5 $+(:,$replace($mid($6,5,1),V,+,O,@,H,%),$gettok($6,2,44)) $gettok($7,2,44)

  echo -a %output
}

It echos

:FlashIrcServer.1 353 Paul = %#!!Roomy :+.Damien @Sarah

Firstly, it is missing the other nicknames,
Secondly, it needs to be .+Damien

any ideas? many thanks.

The last letter of the 4 letter code can only be V or N - noting else. V = voiced. N = not voiced. dnt care about other symbols
Posted By: Wims Re: regex help - 27/12/09 01:36 AM
Oh ok now I see why you want $regsubex :
Code:
alias rtest {
  var %server_str =  :FlashIrcServer.1 353 Paul = $(%#!!Roomy,0) :UMPV,.Damien UUNV,@Sarah UMNV,@Sid UMNV,.Manny[4]
  var %pattern = /(...(.) $+ $chr(44) $+ ([.@]+)?(\S+))/g
  tokenize 32 %server_str
  var %output = $1-5 : $+ $regsubex($right($6-,-1),%pattern,$+($iif(\4,\3),$iif(\2 == V,+),\4))
  echo -a %output
}
© mIRC Discussion Forums