mIRC Home    About    Download    Register    News    Help

Print Thread
#254790 03/09/15 01:17 AM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
With /parseline, -t('as text') or -b('as bvar') is required. This is inconsistant with other mIRC commands that attempt to assume the nature of the input
Code:
bset -t &example 1 :Example!Example@Example.com PRIVMSG $me :Example

; Results in an error
//parseline -iqp $bvar(&example, 1-).text
//parseline -iqp &example



With /parseline new lines in an input do not delimit messages to be parsed
Code:
bset -t &example 1 :Example!Example@Example.com PRIVMSG $me :Example $+ $crlf $+ :Example!Example@Example.com PRIVMSG $me :Example

;; Assumes the entirety of the input as a single message
//parseline -iqpt $bvar(&example, 1-).text
//parseline -iqpb &example




With on PARSELINE, theres quite a few inconsistancies I'm not sure how to explain them other than showing through code:
Code:
; @tags=something :Nick!ident@host.com PRIVMSG #someChannel :text
on $*:PARSELINE:in:/(@\S+) \x3A(([^\s!@]+)![^\s!@]+@[^\s]+) PRIVMSG (#\S+) \x3A.+$/:{
  var %tags = $regml(1)
  var %host = $regml(2)
  var %nick = $regml(3)
  var %chan = $regml(4)

  if (%nick !ison %chan) {
    parseline -iqptn : $+ %host JOIN : $+ %chan
    parseline -iqptn :example!example@example.com MODE %chan +ov %nick %nick
    parseline -iqptn $parseline
    haltdef
    halt
  }
}


If the user is not on the specified channel, this should:
  queue a JOIN event to the channel to be processed
  queue a MODE event to add +ov to the user to be processed
  re-queue the message received to be precoessed
  halt the processing of the current line being parsed
  
What actually happens:
  JOIN isn't processed
  MODE and the original message get processed
  The internal processing doesn't get halted resulting in a loop.


I've discovered more weirdness but am still trying to isolate/understand whats causing it before making a post

Last edited by FroggieDaFrog; 03/09/15 01:18 AM.

I am SReject
My Stuff
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Quote:
With /parseline, -t('as text') or -b('as bvar') is required. This is inconsistant with other mIRC commands that attempt to assume the nature of the input

Yes, this is by design, I chose to force you to make it clear whether the parameter is text or a binary variable.

Quote:
With /parseline new lines in an input do not delimit messages to be parsed

Again, this is by design. You need to specify each new incoming or outgoing line separately.

Quote:
With on PARSELINE, theres quite a few inconsistancies I'm not sure how to explain them other than showing through code:

The on PARSELINE documentation does not mention halt/haltdef and they cannot be used for this event. This is by design. Remember, you can use /parseline to change the current event to anything you want, including an emtpy line.

Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
If I swap out the haltdef/halt with setting the line to a blank line, weirdness still happens

Code:
; @tags=something :Nick!ident@host.com PRIVMSG #someChannel :text
on $*:PARSELINE:in:/(@\S+) \x3A(([^\s!@]+)![^\s!@]+@[^\s]+) PRIVMSG (#\S+) \x3A.+$/:{
  var %tags = $regml(1)
  var %host = $regml(2)
  var %nick = $regml(3)
  var %chan = $regml(4)

  if (%nick !ison %chan) {
    parseline -iqptn : $+ %host JOIN : $+ %chan
    parseline -iqptn :example!example@example.com MODE %chan +ov %nick %nick
    parseline -iqptn $parseline
    parseline -it
  }
}


The above appears not to process the JOIN event-message at all, but the MODE event-message and re-queued PRIVMSG event-message seem to. If I place the /parseline commands on a 0second timer, all works as expected.

--
Q: Since, by design, the /parseline command does not break apart inputs by new lines($crlf) what is the point of the -n switch or supporting bvars?

Last edited by FroggieDaFrog; 03/09/15 06:24 PM.

I am SReject
My Stuff
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Quote:
If I swap out the haltdef/halt with setting the line to a blank line, weirdness still happens

If you add /echos for debugging and also use /debug to output to debug.log, do you see anything interesting?

Quote:
Q: Since, by design, the /parseline command does not break apart inputs by new lines($crlf) what is the point of the -n switch or supporting bvars?

The -n switch is required because every line that goes to or comes from a server must end in a CR/LF. The use and utility of &binvars is up to the scripter.

Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
mkay, added echos and such as requested:
Code:
on $*:PARSELINE:in:/(@\S+) \x3A(([^\s!@]+)![^\s!@]+@[^\s]+) PRIVMSG (#\S+) \x3A.+$/:{
  var %tags = $regml(1)
  var %host = $regml(2)
  var %nick = $regml(3)
  var %chan = $regml(4)

  echo -a tags: %tags - Host: %host - Nick: %nick - chan: %chan

  if ($me ison %chan && %nick !ison %chan) {
    echo -s %nick not on %chan
    parseline -iqptn : $+ %host JOIN : $+ %chan
    parseline -iqptn :example!example@example.com MODE %chan +ov %nick %nick
    parseline -iqptn $parseline
    parseline -it
  }
  else {
    echo -s %nick ison %chan
  }
}


Setup:
Code:
1: Connect to server
2: Join a channel to test against
3: issue the following command from within the channel
    //parseline -iqptnu0 @tags=something :Nick!ident@host.com PRIVMSG # :text



Result in status:
Code:
Nick not on #sreject
-
* Parseline in: :Nick!ident@host.com JOIN :#sreject

-
* Parseline in: :example!example@example.com MODE #sreject +ov Nick Nick

-
* Parseline in: @tags=something :Nick!ident@host.com PRIVMSG #sreject :text

-
* Parseline in: 
-
Nick not on #sreject
-
* Parseline in: :Nick!ident@host.com JOIN :#sreject

-
* Parseline in: :example!example@example.com MODE #sreject +ov Nick Nick

-
* Parseline in: @tags=something :Nick!ident@host.com PRIVMSG #sreject :text

-
* Parseline in: 

--- repeats until /remote off is issued ---


Result in channel**:
Code:
tags: @tags=something - Host: Nick!ident@host.com - Nick: Nick - chan: #sreject
* example sets mode: +ov Nick Nick

tags: @tags=something - Host: Nick!ident@host.com - Nick: Nick - chan: #sreject
* example sets mode: +ov Nick Nick

tags: @tags=something - Host: Nick!ident@host.com - Nick: Nick - chan: #sreject
* example sets mode: +ov Nick Nick

--- repeats until /remote off is issued ---


**The above is DIRECTLY copied from the channel window; possibly an extra $crlf is being applied? The spacing DOES NOT visually appear in the channel window.



Result from debug.log
Code:
<- :Nick!ident@host.com JOIN :#sreject
<- :example!example@example.com MODE #sreject +ov Nick Nick
<- :Nick!ident@host.com JOIN :#sreject
<- :example!example@example.com MODE #sreject +ov Nick Nick
<- :Nick!ident@host.com JOIN :#sreject
<- :example!example@example.com MODE #sreject +ov Nick Nick

--- repeats until /remote off is issued ---


Last edited by FroggieDaFrog; 04/09/15 06:06 PM.

I am SReject
My Stuff
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Quote:
**The above is DIRECTLY copied from the channel window; possibly an extra $crlf is being applied? The spacing DOES NOT visually appear in the channel window.

That is very likely the cause. You are using -n with an incoming line that has already been split at CR/LF and is just about to be parsed. You should not append a CR/LF in this case (unless you want to for some reason). For /parseline -o, the -n ensures that an outgoing line ends in a CR/LF as required by the server.


Link Copied to Clipboard