Random Fake CTCP version Reply

By Shadowless on Mar 03, 2011

NoNeed

on *:connect: {
  ignore -tw *
  debug -i debugoutput fakectcp
  fakectcpversion
}
alias fakectcp {
  tokenize 32 $1-
  if ($1 == <-) && ($3 == PRIVMSG) && (:* iswm $5-) && ($mid($5-,3,-1) == VERSION) {
    ctcpreply $mid($gettok($2,1,33),2) $v1 %fakectcpshow 
    fakectcpversion 
  }
}
alias fakectcpversion {
  var %c $r(1,10)
  if (%c = 1) { set %fakectcpshow eggdrop v1.6.19+ctcpfix }
  if (%c = 2) { set %fakectcpshow rZNC Version 1.0 [02/01/11] - Built from ZNC. }
  if (%c = 3) { set %fakectcpshow xchat 2.8.8 Ubuntu }
  if (%c = 4) { set %fakectcpshow http://www.mibbit.com ajax IRC Client .2620  }
  if (%c = 5) { set %fakectcpshow Eteria IRC Client }
  if (%c = 6) { set %fakectcpshow Snak for Macintosh 4.13 English }
  if (%c = 7) { set %fakectcpshow BR .NET Irc Client 1.3.0 }
  if (%c = 8) { set %fakectcpshow Black-Cell client version 2.0.1 }
  if (%c = 9) { set %fakectcpshow Trillian }
  if (%c = 10) { set %fakectcpshow PIRCH98:WIN 95/98/WIN NT:1.0 (build 1.0.1.1190) }
}

Comments

Sign in to comment.
sean   -  Nov 21, 2012
var %version = mIRC Version 7.0
hadd -m ctcp version %version
echo -ae $hget(ctcp, version)

Hash tables are easy to use. Perhaps it's something you should look at a bit more in depth. Also, it's not the compiler's full responsibility. As a developer, it's imperative that you understand the language you're developing in. :)

PS: Please excuse my horrible MSL syntax, haven't touched it in awhile.

 Respond  
raccoon   -  Nov 21, 2012

The higher priority is clean code. It's the responsibility of the compiler or runtime engine to improve a code's performance.

 Respond  
sean   -  Nov 21, 2012

That kind of mentality keeps newbies from learning more and progressing their craft. As developers, performance should always be high priority :)

 Respond  
raccoon   -  Nov 21, 2012

Creating hash tables in place of global variables, even single infrequently used ones? I don't like this idea, even if there are 3 or 4 cpu cycles saved. In the long run it's sloppy (to me), and harder for newbies to work with.

 Respond  
sean   -  Nov 21, 2012

@raccoon That's actually an excellent point. However, I would use a hash in lieu of a global variable. Not only are they automatically cleared upon exit but, they're also faster and less resource intensive.

 Respond  
raccoon   -  Nov 21, 2012

I'd stick with the global variable /sets, changing them to /set -e (unsets when client is closed), and check if the variable has been initialized yet. Such that a version reply is selected at random the first time you are /ctcp versioned, and the same reply is sent for the entire session of multiple version requests.

Sending a different reply seconds apart will only prove you're faking it.

 Respond  
gooshie   -  Nov 27, 2011

disocool
we already figured all that out like almost nine months ago.
oic trying to help d3oneGeneral... ok, as you were.

 Respond  
dlsocool   -  Nov 24, 2011

d3oneGeneral,

on :connect: {
.ignore -tw
<------------------ make sure you set this? t = ctcp, w = makes the ignore apply to any network.
.debug -i debugoutput fakectcp
}

 Respond  
d3oneGeneral   -  Jul 28, 2011

[20:02.01] [testnick VERSION]

-
[20:02.02] [testnick VERSION reply]: mIRC v7.17 Khaled Mardam-Bey

whats this?

 Respond  
Jethro   -  Mar 03, 2011

Right on. gooshie. I was eyeballing your example without giving it a whirl. I should have done so. :p

 Respond  
gooshie   -  Mar 03, 2011

Jethro_,
The return prevents that.

 Respond  
Jethro   -  Mar 03, 2011

gooshie, I believe the halt is needed for each goto condition at the end. Otherwise it may loop through all of them upon trigger.

 Respond  
gooshie   -  Mar 03, 2011

Scakk,
This is about the only good use I have seen for a goto jump to date. This is the exception to the rule that goto's lead to harder to read spaghetti code.

 Respond  
Scakk   -  Mar 03, 2011

@gooshie .. I always forget that goto's are usable like that :|

I am not that great at regex so I used a shorter if statement

if ($3 === PRIVMSG && VERSION isincs $5) { .ctcpreply $mid($gettok($2,1,33),2) $v1 $fakectcpversion }
 Respond  
gooshie   -  Mar 03, 2011
on *:connect: {
  .ignore -tw *
  .debug -i debugoutput fakectcp
}
alias fakectcp {
  if $regex($1,/^<- :(.+)!\S+ PRIVMSG $me :.VERSION.$/S) {
    ctcpreply $regml(1) VERSION $fakectcpversion 
  }
}
alias fakectcpversion {
  goto $r(1,9)
  :1 | return Trillian
  :2 | return Eteria IRC Client
  :3 | return xchat 2.8.8 Ubuntu
  :4 | return eggdrop v1.6.19+ctcpfix
  :5 | return BR .NET Irc Client 1.3.0
  :6 | return Snak for Macintosh 4.13 English
  :7 | return Black-Cell client version 2.0.1
  :8 | return http://www.mibbit.com ajax IRC Client .2620
  :9 | return rZNC Version 1.0 [02/01/11] - Built from ZNC.
}
 Respond  
Jethro   -  Mar 03, 2011

Nice suggestion, Scakk. By using return you don't need to set a global variable for each random version reply unnecessarily.

 Respond  
Scakk   -  Mar 03, 2011

You can remove the variable and use return instead in the alias "fakectcpversion" if you remove the variable part in the ctcpreply line and use $fakectcpversion instead as noted below.

ctcpreply $mid($gettok($2,1,33),2) $v1 $fakectcpversion
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.