mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2003
Posts: 22
S
Segosa Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2003
Posts: 22
I'll try to put this as simple as possible, first of all I have this code:

Code:
alias msgplus sockopen msgplus msgplus.net 80

on *:SOCKOPEN:msgplus:{
  sockwrite -n $sockname GET /msgplus-manual.php HTTP/1.1
  sockwrite -n $sockname Host: www.msgplus.net
  ;sockwrite -n $sockname Connection: keep-alive;
  sockwrite $sockname $crlf
  echo -cat topic * Connected...
}

on *:SOCKCLOSE:msgplus:echo -cat ctcp * Connection terminated by the server.

on *:SOCKREAD:msgplus:{
  if ($sockerr) { echo 4 -at $+([,$sock($sockname).wserr,]) $sock($sockname).wsmsg | return }
  ;echo 3 -at * Before: $!sockbr: $sockbr
  sockread %c
  echo -ca info $iif(%c,$ifmatch,-)
  ;echo 3 -at * After: $!sockbr: $sockbr
} 


Now, on my computer if I do /msgplus, I get:

Quote:
[18:45:26] * Connected...
HTTP/1.1 200 OK
Date: Sat, 31 Jan 2004 17:45:20 GMT
Server: Apache/1.3.27 (Unix) mod_gzip/1.3.26.1a mod_python/2.7.8 Python/2.2.2 mod_webapp/1.2.0-dev mod_perl/1.27 mod_throttle/3.1.2 PHP/4.3.2 FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.7b
X-Powered-By: PHP/4.3.2
X-Accelerated-By: PHPA/1.3.3r2
Content-Type: text/html
Age: 0
Connection: close
-
[18:45:27] * Connection terminated by the server.


If anyone else does it, about 5 people I've tried it with, they get:

Quote:
(17:37:54) * Connected...
HTTP/1.1 200 OK
Date: Sat, 31 Jan 2004 17:37:52 GMT
Server: Apache/1.3.27 (Unix) mod_gzip/1.3.26.1a
mod_python/2.7.8 Python/2.2.2 mod_webapp/1.2.0-dev
mod_perl/1.27 mod_throttle/3.1.2 PHP/4.3.2
FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.7b
X-Powered-By: PHP/4.3.2
X-Accelerated-By: PHPA/1.3.3r2
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
-
4
2074
-
-
(17:37:55) * Connection terminated by the server.


Notice that OTHER people seem to have an extra "4", "2074" line, this is the information I want! I have tried SO many different ways to try get it to appear, I've changed the script around so many times I couldn't change it anymore, this way It works, for other people.

I want to figure out why on earth it just doesn't work on my internet connection! I tried on another computer on my network with it and it didn't work either, so it must be my internet connection, what can I do about this?

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Try "sockread -f %c"

Joined: Dec 2003
Posts: 22
S
Segosa Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2003
Posts: 22
with -f switch:

Quote:
[19:21:08] * Connected...
HTTP/1.1 200 OK
Date: Sat, 31 Jan 2004 18:21:03 GMT
Server: Apache/1.3.27 (Unix) mod_gzip/1.3.26.1a mod_python/2.7.8 Python/2.2.2 mod_webapp/1.2.0-dev mod_perl/1.27 mod_throttle/3.1.2 PHP/4.3.2 FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.7b
X-Powered-By: PHP/4.3.2
X-Accelerated-By: PHPA/1.3.3r2
Content-Type: text/html
Age: 1
Connection: close
-
[19:21:10] * Connection terminated by the server.

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Are you using the latest mIRC, v6.12?

Joined: Dec 2003
Posts: 22
S
Segosa Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2003
Posts: 22
Yep, 6.12

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
You can try either changing "HTTP/1.1" to "HTTP/1.0", or, if even that doesn't work, read into a binary variable:
  • sockread &var
    echo > $bvar(&var,1-).text

Joined: Dec 2003
Posts: 22
S
Segosa Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2003
Posts: 22
Success is near!
Even though I've never worked with binary variables..

Quote:
[19:30:33] * Connected...
> HTTP/1.1 200 OK
Date: Sat, 31 Jan 2004 18:30:27 GMT
Server: Apache/1.3.27 (Unix) mod_gzip/1.3.26.1a mod_python/2.7.8 Python/2.2.2 mod_webapp/1.2.0-dev mod_perl/1.27 mod_throttle/3.1.2 PHP/4.3.2 FrontPage/5.0.2.2510 mod_ssl/2.8.14 OpenSSL/0.9.7b
X-Powered-By: PHP/4.3.2
X-Accelerated-By: PHPA/1.3.3r2
Content-Type: text/html
Age: 0
Connection: close

2074
[19:30:34] * Connection terminated by the server.


That appeared, without being CRLF delimited though, so I guess I have to do that myself, I'll see if I can do that now.. oh and HTTP/1.0 didn't work.

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
So, it appears in one line... you can use $gettok($bvar(&var,1-).text,-1,10) to get the number only.

Joined: Dec 2003
Posts: 22
S
Segosa Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2003
Posts: 22
smile one step ahead of you smile

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
/sockread -f into a regular %var should work though. Sounds like a bug. Anyway, I'm glad to hear the problem is eventually solved.

Joined: Dec 2003
Posts: 22
S
Segosa Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2003
Posts: 22
Yeah could be a bug, oh well, I found a way smile .

Now when I type /msgplus on IRC, I send:

[19:43:32] <Segosa> Latest Messenger Plus! version is v2 build 074!

smile , and for anyone who's interested in what the code turned out to be:

Code:
alias msgplus sockopen msgplus msgplus.net 80
on *:SOCKOPEN:msgplus:{
  sockwrite -n $sockname GET /msgplus-manual.php HTTP/1.1
  sockwrite -n $sockname Host: www.msgplus.net
  sockwrite -n $sockname Connection: keep-alive;
  sockwrite $sockname $crlf
}
on *:SOCKREAD:msgplus:{
  sockread &amp;var
  set -u5 %msgplus.version $remove($gettok($bvar(&amp;var,1-).text,-1,13),$lf)
  msg $active Latest Messenger Plus! version is $+ $left(%msgplus.version,1) build $mid(%msgplus.version,2) $+ !
}


Link Copied to Clipboard