This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

421 and 530 check in ftp

Old posts that have not been replied to for several years.
Locked
a
alik

421 and 530 check in ftp

Post by alik »

hello i have this script :



bind msg - test ddd:test
proc ddd:test {nick userhost handle text} {
global aaaaass statval host user port pass
set aaaaass [uri::split $text]
set port [lindex $aaaaass 1]
set host [lindex $aaaaass 7]
set user [lindex $aaaaass 11]
set pass [lindex $aaaaass 13]
set statval [ftp::Open $host $user $pass -port $port -output]
if {$statval == 0} {
putserv "PRIVMSG $nick : \002FTP \002 \0034down\0034!"
} else {
putserv "PRIVMSG $nick : \002FTP \002 \0039up\0039!"
ftp::Close $statval;

}
}


how i check if the ftp return 421 or 530 right now it's just checking if it's loged or not loged
10x
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

There that should take care of it .. i think. Haven't tested it tho so ..

Code: Select all

# Usage: ftpcheck ip port login pass
proc ftpcheck {host port user pass} {
  catch {socket $host $port} sock
  if {[string match -nocase "sock?" $sock]} {
    puts $sock "USER $user"
    puts $sock "PASS $pass"
    while {![eof $sock]} {
      flush $sock
      gets $sock line
      if {[string match -nocase 421 [lindex $line 0]]} {
         putserv "PRIVMSG $nick :Ftp Full."
         close $sock
         return 0
      } elseif {[string match -nocase 530 [lindex $line 0]]} {
         putserv "PRIVMSG $nick :Account Disabled."
         close $sock
         return 0
      } elseif {[string match -nocase 230 [lindex $line 0]]} {
         putserv "PRIVMSG $nick :Logged in."
         close $sock
         return 1
      }
    }
    close $sock
  } else {
    putserv "PRIVMSG $nick :Error No Route Host."
    return 0
  }
}
XplaiN but think of me as stupid
a
alik

Post by alik »

10x i'll test it
a
alik

Post by alik »

10x man
it's working great
a
alik

Post by alik »

i have 1 problem

with ->

if {[string match -nocase "sock?" $sock]} {

could u tell me what it means .. what it check's
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

See string manual.
Once the game is over, the king and the pawn go back in the same box.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

when a non async connection is made the socket command returns a value that value is $sock in this case if u resolve the variable then it will match sock1 or sock2 depends on how many sock are open or witch one is available.. so if u wana check if a connection is made u do string match -nocase .. for sock? "?" cause u don't know the value you also could do sock*
i have 1 problem
with ->
if {[string match -nocase "sock?" $sock]} {
what is the problem??

you don't need the ftp lib to do this .. so ..
XplaiN but think of me as stupid
Locked