mIRC based IRC client

By GrimReaper on Mar 31, 2011

I know it's probably a waste of space and probably useless, But I wanted to see what I could do with sockets, So I decided to /try/ make a Mini IRC client within mIRC.

How to use:

Firstly, Use /mmirc to open the dialog, Then enter in all the details that you wish to use..

Then hit connect and it will connect to the server and channel specified..

I will be updating it eventually to allow multiple channels, At the moment it only does one channel and there is no nicklist menu at the moment.. It's currently a work in progress, But this is a working script, I have tested it alot..

CTCP replies work thank's to a little help from FordLawnmower with the syntax.

dialog Mini_mIRC {
  title "Mini mIRC by Danneh"
  size -1 -1 286 171
  option dbu
  box "Current Messages:", 1, 3 3 219 142
  box "NickList:", 2, 223 3 60 142
  text "Message:", 3, 3 153 23 8
  edit "", 4, 28 152 207 10, autohs
  button "Send", 5, 242 151 37 12
  edit "", 9, 7 12 210 128, read multi return autovs
  list 10, 227 12 51 128, size
  menu "File", 6
  item "Disconnect", 7, 6
  item "Exit", 8, 6, cancel
}
dialog Mini_Setup {
  title "Mini mIRC Setup by Danneh"
  size -1 -1 118 103
  option dbu
  text "Nick:", 1, 3 3 12 8
  edit "", 4, 18 2 98 10
  text "Server:", 5, 3 17 18 8
  edit "", 6, 24 16 92 10
  text "Port:", 7, 3 31 12 8
  edit "", 8, 19 30 97 10
  text "Ident:", 9, 3 45 15 8
  edit "", 10, 22 44 94 10
  text "Realname:", 11, 3 59 26 8
  edit "", 12, 32 58 84 10
  button "Connect/Disconnect", 13, 11 87 51 12
  button "Close", 14, 69 87 37 12
  text "Channel:", 15, 3 73 22 8
  edit "", 16, 29 72 87 10
  menu "File", 2
  item "Exit", 3, 2, cancel
}

alias mmIRC { dialog $iif($dialog(Mini_Setup),-v,-m Mini_Setup) Mini_Setup }

on *:DIALOG:Mini_Setup:sclick:13,14: {
  if ($did == 13) {
    if ($istok($did(4)|$did(6)|$did(8)|$did(10)|$did(12)|$did(16),$null,124)) {
      noop $input(Please make sure ALL fields are filled.,o,Error!)
    }
    elseif (*.*.* !iswm $did(6)) { noop $input(Current server field is entered incorrectly.. Please try again.,o,Error!) }
    else {
      sockopen minimirc $did(6) $did(8)
      sockmark minimirc $did(4) $did(10) $did(16) $did(12)
      dialog -x $dname
      dialog -m Mini_mIRC Mini_mIRC
    }    
  }
  if ($did == 14) { dialog -x Mini_Setup }
}
on *:DIALOG:Mini_mIRC:sclick:5: {
  if ($did(4) == $null) { noop $input(Please enter something to send.,o,Error!) }
  if (/part == $left($did(4),5)) { minisend PART $gettok($did(4),2,32) :Mini mIRC version $miniversion | did -a Mini_mIRC 9 $time(hh:nn tt) * You have parted $gettok($did(4),2,32) $crlf | did -rf Mini_mIRC 4 | did -r Mini_mIRC 10 HALT }
  if (/join == $left($did(4),5)) { minisend JOIN $gettok($did(4),2,32) | did -a Mini_mIRC 9 $time(hh:nn tt) * You have joined $gettok($did(4),2,32) $crlf | did -rf Mini_mIRC 4 | HALT }
  if (/nick == $left($did(4),5)) { minisend NICK $gettok($did(4),2,32) | did -a Mini_mIRC 9 $time(hh:nn tt) * You have changed nick to: $gettok($did(4),2,32) $crlf | sockmark minimirc $puttok($sock(minimirc).mark,$gettok($did(4),2,32),1,32) | did -r Mini_mIRC 4 | HALT }
  if (/me == $left($did(4),3)) { minisend PRIVMSG $gettok($sock(minimirc).mark,3,32) :ACTION $gettok($did(4),2-,32) $+  | did -a Mini_mIRC 9 $time(hh:nn) * $gettok($sock(minimirc).mark,1,32) $gettok($did(4),2-,32) $crlf | did -rf $dname 4 | HALT }
  if (/quit == $left($did(4),5)) { minisend QUIT $gettok($did(4),2-,32) | did -a Mini_mIRC 9 $time(hh:nn tt) * You have been disconnected from $+($sock(minimirc).addr,$chr(58),$sock(minimirc).port) $+ $crlf | did -rf Mini_mIRC 4 | HALT }
  if (/ns == $left($did(4),3)) { minisend PRIVMSG NickServ $+(:,$gettok($did(4),2-,32)) | did -a Mini_mIRC 9 $time(hh:nn tt) * Messaging NickServ with: $gettok($did(4),2-,32) $+ $crlf | did -rf Mini_mIRC 4 | HALT }
  else { minisend PRIVMSG $gettok($sock(minimirc).mark,3,32) $+(:,$did(4)) | did -a Mini_mIRC 9 $time(hh:nn tt) * $+(<,$gettok($sock(minimirc).mark,1,32),>) $did(4) $crlf | did -rf $dname 4 | HALT }
}

on *:DIALOG:Mini_mIRC:menu:7: {
  dialog -x Mini_mIRC
  dialog -m Mini_Setup Mini_Setup
  tokenize 32 $sock(minimirc).mark
  did -a Mini_Setup 4 $1
  did -a Mini_Setup 10 $2
  did -a Mini_Setup 12 $4-
  did -a Mini_Setup 16 $3
  did -a Mini_Setup 6 $sock(minimirc).addr
  did -a Mini_Setup 8 $sock(minimirc).port
  .sockclose minimirc
}

on *:SOCKOPEN:minimirc:{ tokenize 32 $sock($sockname).mark
  sockwrite -nt $sockname nick $1
  sockwrite -nt $sockname user $2 $2 $2 : $+ $4- Version $miniversion $+ .
  sockwrite -nt $sockname join $3
}

on *:SOCKREAD:minimirc:{ 
  sockread %minimirc
  if ($dialog(Mini_mIRC)) {
    if ($sockerr) { did -a Mini_mIRC 9 * $time(hh:nn tt) ERROR $sock($sockname).wsmsg | HALT }
    if (PING !isin %minimirc) || (ACTION !isin %minimirc) || ($gettok($sock(minimirc).addr,2,46) !isin %minimirc) { did -a Mini_mIRC 9 $time(hh:nn tt) * $chr(58) $remove($+(<,$gettok(%minimirc,1,33),>),$chr(58)) $minifix($gettok(%minimirc,4-,32)) $+ $crlf | HALT }
    tokenize 32 %minimirc
    if ($1 == PING) { minisend PONG $minifix($2) | HALT }
    if ($minifix($4) == VERSION) { minisend NOTICE $minifix($gettok($$1,1,33)) $+(:,$chr(1),VERSION) Mini mIRC version $miniversion by Danneh/GrimReaper }
    if ($minifix($4) == TIME) { minisend NOTICE $minifix($gettok($$1,1,33)) $+(:,$chr(1),TIME) $+($time(hh:nn tt),) }
  }
}

on *:JOIN:#: {
  if ($sock(minimirc)) && ($nick == $gettok($sock(minimirc).mark,1,32)) {
    var %a = 1, %b = $nick(#,0)
    while (%a <= %b) {
      did -a Mini_mIRC 10 $iif($istok(~|&|@|%|+,$left($nick(#,%a).pnick,1),124),$+($left($nick(#,%a).pnick,1),$nick(#,%a)),$nick(#,%a))
      inc %a
    }
  }
}

alias -l minisend { .sockwrite -nt minimirc $1- }
alias -l miniversion { return 1.0 }
alias -l minifix {
  var %minifix2 = $mid($$1,2-)
  return %minifix2
}

Comments

Sign in to comment.
Known   -  Apr 03, 2011

hmm I like this idea, it's something new and might be worth it if you make it amazingly:P

nice work GrimReaper

 Respond  
Firstmate   -  Mar 31, 2011

Take a look at the RFC (namely 4.6.2 and 4.6.3)
http://www.irchelp.org/irchelp/rfc/rfc.html

 Respond  
GrimReaper   -  Mar 31, 2011

I haven't quite figured out how to get it to stay connected constantly, That's something that I am going to work on.. This is just version 1, But will make better updates in future releases.

 Respond  
_Dean_   -  Mar 31, 2011

its a nice idea... but look, you should use the on dialog close event to close all sockets, by the way, i stayed connected
for some minutes and get disconnected by "ping timeout"

strip all output messages, cause in dialog it will be with the control codes

 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.