mIRC Home    About    Download    Register    News    Help

Print Thread
#115372 25/03/05 06:32 PM
Joined: Mar 2005
Posts: 15
phishes Offline OP
Pikka bird
OP Offline
Pikka bird
Joined: Mar 2005
Posts: 15
i have this really strange problem, i've got this code to show like the nick/address and common channels a user has when they query me or i query them, i stumbled on a problem if the user is outside of a channel i couldn't get the address, then solved it by whoising them but hiding it, now i have the problem if someone queries me their text appears before the informarion

Code:
on *:open:?:*:{ %q.a = o | .raw -q whois $nick }
alias query { .query $1- | %q.a = o | .raw -q whois $1 |   .load.switchbar }
alias q.open {
  var %q.cc = $comchan($1,0), %q.c,%q.l = 1
  echo -i25 $1 query opened with ( $+ $1 $+ $iif(%q.addr != $null,$chr(32) $+ $v1) $+ ) | unset %q.addr
  while (%q.l <= %q.cc) { %q.c = %q.c $comchan($1,%q.l) $+ $iif(%q.l != %q.cc,$chr(44)) | inc %q.l }
  echo -i25 $1 you are on %q.cc common channel $+ $iif(%q.cc != 1,s) with $1 $+ $iif(%q.cc > 0,$chr(44) which $iif(%q.cc > 1,are,is) $+ : %q.c)
}
Raw 311:*:{ if (%q.a) { %q.addr = $3 $+ @ $+ $4 | q.open $2 | unset %q.a | halt } | else { | halt } }
  

#115373 25/03/05 11:39 PM
Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
Try this

Code:
 on ^*:open:?:*:{ 
  if ( !$($+(%,q.a,.,$nick),2) ) {
    set $+(%,q.a,.,$nick) $1- 
    .whois $nick 
    .enable #query
    haltdef
  }
}

alias query { 
  .query $1- 
  .load.switchbar
}
alias q.open {
  query $1
  var %q.l = 1, %q.cc = $comchan($1,0)
  echo $1 >> query opened with ( $+ $2 $+ ) 
  while $comchan($1,%q.l) { 
    var %q.c = $addtok(%q.c, $v1, 44)
    inc %q.l 
  }
  echo -i25 $1 >> you are on %q.cc common channel(s) with $1 $+ $iif(%q.cc > 0,$chr(44) which $iif(%q.cc > 1,are,is) $+ : %q.c )
  echo -t $1 $($+(%,q.a,.,$1),2)
  unset $+(%,q.a,.,$1)
}

#query off
raw 301:*: halt
raw 311:*:{
  if ( $($+(%,q.a,.,$2),2) ) { 
    q.open $2 $+($3,@,$4) 
    halt
  }
}
raw 313:*: halt
raw 312:*: halt
raw 330:*: halt
raw 319:*: halt
raw 318:*: .disable #query | halt
#query end 
 


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
#115374 26/03/05 12:38 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
using your code, add this.

It simply catches the text being sent by $nick, and if %q.a is still set halts the event, and delays the text for 1 second, which should be enough for the raw 311 to have completed.

You may want to add the whois responce masking that XDaeMon shows in his script but since you wernt doing it already I didnt want to change it.

While xDaeMon script is very good i felt it failing is that it halts the opening of the window thus causing multiple ON OPEN events to trigger if more than one line is being sent, each one replacing the previous line into $%q.a.$nick, and doing a whois each time. The first raw 318 well of course shut down the possable problem of multiple 311's tripping q.open but only the last ON OPEN text well have been displayed.

Code:
on ^*:text:*:?:{
  if (%q.a) {
    haltdef
    var %temptext = $+(%,temptext.,$ticks,.,$mid($rand(10000,19999),2))
    set -u60 $(%temptext,1) $+(<,$nick,>) $1-
    .timer 1 1 if $!window( $!( $+ $nick $+ ,) ) $({,) echo -itlbfmr $!( $+ $nick $+ ,) %temptext $(},)
  }
}

#115375 26/03/05 01:18 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hmm Dave, why are you using escaped $evals for $nick which evaluates (and has to) now anyways?

Why not just .timer 1 1 if ($query( $nick )) echo -itlbfmr $nick %temptext ?

Greets


Gone.
#115376 26/03/05 01:46 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I been testing some scripts i wrote for security weaknesses and found under some situations (now i look this wasnt one) that you can get the sent text executing
When the sending nick is /nick |

Im likely being over cautious as it was a quite unique situation that allowed it. Dosnt hurt to be carefull, Does slow ya down tho , lot more typing as well frown

Only found it becuase im using | on a network and happened to tell a guy //echo -a $IP and it did!

#115377 26/03/05 01:52 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
A nickname cannot contain spaces, so any occurence of | in it is never evaluated, if you were afraid of such thing.

$(<nickname>,) is always going to be the same as just <nickname>...

Anyway, it's not up to me to say how others should code, just giving tips smile

Greets


Gone.
#115378 26/03/05 01:55 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
no the nick is just | on its own

#115379 26/03/05 01:55 AM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
I think you must be mistaking this for something else, mIRC completely ignores | unless it's separated by spaces, so | being in a nick cannot force commands in the variable to be executed since nicks can't contain spaces.


New username: hixxy
#115380 26/03/05 01:56 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
lol replied like 5 seconds before u posted

#115381 26/03/05 02:06 AM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
After reading your reply before mine, I tested it with FiberOPtics and you're right, I get an "* /if: invalid format" error.


New username: hixxy
#115382 26/03/05 02:09 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I'm surprised a single | is allowed as a nick, jesus (and I'm an atheist), this is potentially very dangerous.

Greets


Gone.
#115383 26/03/05 04:01 PM
Joined: Mar 2005
Posts: 15
phishes Offline OP
Pikka bird
OP Offline
Pikka bird
Joined: Mar 2005
Posts: 15
Thanks for the help guys, it works ok, just not if someone pastes more than 1 line at a time. smirk

#115384 26/03/05 11:43 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
on *:open:?:*:{ %q.a = o | .raw -q whois $nick }
;
alias query { .query $1- | %q.a = o | .raw -q whois $1 |   .load.switchbar }
;
alias q.open {
  var %q.cc = $comchan($1,0), %q.c,%q.l = 1
  echo -i25 $1 query opened with ( $+ $1 $+ $iif(%q.addr != $null,$chr(32) $+ $v1) $+ ) | unset %q.addr
  while (%q.l &lt;= %q.cc) { %q.c = %q.c $comchan($1,%q.l) $+ $iif(%q.l != %q.cc,$chr(44)) | inc %q.l }
  echo -i25 $1 you are on %q.cc common channel $+ $iif(%q.cc != 1,s) with $1 $+ $iif(%q.cc &gt; 0,$chr(44) which $iif(%q.cc &gt; 1,are,is) $+ : %q.c)
}
;
Raw 311:*:{ if (%q.a) { %q.addr = $3 $+ @ $+ $4 | q.open $2 | q.despool.held.text $2 | unset %q.a | halt } | else { | halt } }
;
alias -l q.despool.held.text {
  if $!window($1) {
    var %i = 1
    while ($var($+(%,q.,$1,.text.line.,%i),1)) {
      echo -itlbfmr $1 $($+(%,q.,$1,.text.line.,%i),2)
      inc %i
    }
  }
  unset $+(%,q.,$1,.lines.counter)
  unset $+(%,q.,$1,.text.line.*)
  .timer $+ $+(.q.,$1,.text.despooler) off
}
;
on ^*:text:*:?:{
  if (%q.a) {
    haltdef
    inc -u60 $+(%,q.,$nick,.lines.counter)
    set -u60 $+(%,q.,$nick,.text.line.,$($+(%,q.,$nick,.lines.counter),2)) $+(&lt;,$nick,&gt;) $1-
    if ($($+(%,q.,$nick,.lines.counter),2) == 1) {
      .timer $+ $+(.q.,$nick,.text.despooler) 1 1 q.despool.held.text $!( $+ $nick $+ ,)
    }
  }
}


It just stores all the lines untill (1) the whois does its biz or (2) the timer goes off (incase the whois dont come back), in either event it then displays all the stored lines.
Note the change to RAW 311 this is to get them stored lines out.

#115385 27/03/05 02:56 PM
Joined: Mar 2005
Posts: 15
phishes Offline OP
Pikka bird
OP Offline
Pikka bird
Joined: Mar 2005
Posts: 15
Thanks alot!! smile smile smile


Link Copied to Clipboard