Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Socket Status Addon For Mirc
imacul8
post Sep 3 2006, 03:15 AM
Post #1


Member [Level 3]
******

Group: Members
Posts: 95
Joined: 21-May 06
From: Adelaide, Australia
Member No.: 24,017



This addon will display the status of your open sockets (if there is any)

Displays displays the Name, IP, Port, Status - Bytes sent/received & last Sent/recieved
Has options to refresh the status, close a socket and close all sockets.

Copy and paste this code below into your remotes (alt + r)
To run the dialog u can simply type /sockstats or u can add a popup to your menubar or wherever to open it.

ie. &Socket Status:/sockstats in your status popup section (alt + p)

**IF you have no active sockets it wont open the dialog, it will just return no open sockets in your active window.

CODE
alias sockstats { if ($sock(*,1)) {
    if ($dialog(sockstats) == $null) {
      dialog -m sockstats sockstats
    }
  }
  else echo -a 12¯ There is currently no Active mIRC sockets
}

dialog sockstats {
  title "(D)Socket Status"
  size -1 -1 182 84
  option dbu
  box "", 1, -5 -3 200 4
  box "", 2, -3 -2 200 4
  box "", 3, -3 68 200 4
  list 4, 0 3 41 67, sort size
  box "", 100, 42 1 139 44
  text "Name :", 5, 45 7 19 8
  text "IP :", 6, 45 16 19 8
  text "Port :", 7, 45 25 19 8
  text "Status :", 8, 45 34 19 8
  text "", 9, 68 7 109 8
  text "", 10, 68 16 109 8
  text "", 11, 68 25 109 8
  text "", 12, 68 34 109 8
  box "", 13, 42 41 70 28
  text "Bytes Sent :", 14, 45 47 30 8
  text "Last Sent :", 15, 45 56 30 8
  box "", 16, 111 41 70 28
  text "Bytes Rcvd:", 17, 114 47 30 8
  text "Last Rcvd:", 18, 114 56 27 8
  text "", 19, 76 47 33 8
  text "", 20, 76 56 33 8
  text "", 21, 145 47 33 8
  text "", 22, 145 56 33 8
  button "&Refresh", 23, 1 73 25 8
  button "&Close", 24, 27 73 25 8
  button "&Close All", 25, 53 73 25 8
  button "&Exit", 26, 156 73 25 8, ok cancel
  box "", 27, -3 79 200 4
  box "", 28, -3 80 200 4
}
on *:DIALOG:sockstats:init:*: {
  sockload
}
on *:DIALOG:sockstats:sclick:*: {
  var %dsn = $did(4).seltext
  did -r sockstats 9,10,11,12,19,20,21,22
  if ($did == 4) {
    if ($sock(%dsn) == $null) sockload
    did -ra sockstats 9 %dsn
    did -ra sockstats 10 $sock(%dsn).ip
    did -ra sockstats 11 $sock(%dsn).port
    did -ra sockstats 12 $sock(%dsn).status
    did -ra sockstats 19 $sock(%dsn).sent byte(s)
    did -ra sockstats 21 $sock(%dsn).rcvd byte(s)
    did -ra sockstats 20 $sock(%dsn).ls sec(s)
    did -ra sockstats 22 $sock(%dsn).lr sec(s)
  }
  if ($did == 23) {
    sockload
  }
  if ($did == 24) {
    if ($sock(%dsn)) sockclose $sock(%dsn)
    sockload
  }
  if ($did == 25) {
    .timer 1 0 closealls
  }
}
alias closealls {
  if (($sock(*,0)) && ($?!="This will close all active mIRC sockets. $+ $crlf $+ Are you sure?")) {
    sockclose *
    dialog -k sockstats
    echo -a 4» All mIRC sockets are closed
  }
}
alias sockload {
  did -r sockstats 4
  if ($sock(*,0)) { var %sckstats.tmp = 1
    while ($sock(*,%sckstats.tmp)) {
      did -a sockstats 4 $sock(*,%sckstats.tmp)
      inc %sckstats.tmp
    }
  }
}


Any feedback would be great thankyou, any questions,suggestions,bugs,comments will be greatly appreciated smile.gif

thankyou and enjoy
Go to the top of the page
 
+Quote Post
Urza
post Oct 5 2006, 04:48 AM
Post #2


Newbie [Level 1]
*

Group: Members
Posts: 13
Joined: 5-October 06
Member No.: 31,096



not a bad little script smile.gif

couple of suggestions:

> If the dialog is already open when the sockstats alias is called, use dialog -v to make it the active window

> get rid of this line so that you can actually click the dialog without clearing the stats, as it serves no purpose
QUOTE
did -r sockstats 9,10,11,12,19,20,21,22


> why the timer in the close all button? it serves no purpose

Go to the top of the page
 
+Quote Post
tractor
post Oct 5 2006, 05:46 AM
Post #3


Premium Member
********

Group: Members
Posts: 197
Joined: 28-September 06
Member No.: 30,705



True wouldn't you just close it. I only use timers for selling on #rsmarket and for other events like a clan event.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Mirc Snippets(10)
  2. Few Mirc Snippets I Have Scripted(19)
  3. Control Parts Of Msn Through Mirc(7)
  4. How To Customize The Look Of Your Mirc Events(4)
  5. Sockets Help (mirc)(8)
  6. Mirc 3d Rendering(0)
  7. I Am Looking For Ideas For A Mirc Addon(1)
  8. Need Help With Mirc(0)


 



- Lo-Fi Version Time is now: 6th September 2008 - 01:31 AM