egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Ignoring feedback on ftp-ing..

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Devilion
Voice


Joined: 04 May 2005
Posts: 7

PostPosted: Thu Oct 04, 2007 5:11 pm    Post subject: Ignoring feedback on ftp-ing.. Reply with quote

Hi, I've edited myself a little script that upload a file to another server of mine using ncftp (another linux ftp client, because I don't have access to the normal ftp)..

My problem is that, when the script is executed, I always get this error:
(22:52:59) (dless) [22:54] Tcl error [affv_dcctrig]: /home/albert/dless/index.html:
(22:52:59) (dless) .../dless/index.html: ETA: 0:00 15.44/ 15.44 kB 56.25 MB/s
(22:52:59) (dless) .../dless/index.html: ETA: 0:00 15.44/ 15.44 kB 531.45 kB/s

Whilst that is not an error, it is the response to the uploading commands of ncftp, so, it works, and it uploads the file, but the script breaks off right then and there, because of the error.

How do I tell the bot to ignore this text, and not see it as an error?

This is the code:
Code:
proc affv_dcctrig {handle ipx arg} {
  global affvpath affvconfig affvchan
  global affv_localdir affv_useftp affv_url
  putlog "affv: Please wait..."
  exec $affvpath -co $affvconfig
  foreach affvc [string tolower $affvchan] {
    set affv_filename "$affvnew.html"
    set affv_newurl "$affv_url/$affv_filename"
    if {$affv_useftp == 1} {
     set affv_localfile "$affv_localdir/$affv_filename"
      affv_sendftp $affv_localfile
      puthelp "PRIVMSG #channel : $affv_url"
     return 0
    }
  puthelp "PRIVMSG #channel : $affv_url"
  }
}


which triggers:

Code:
proc affv_sendftp { localfile } {
 global pingcheck 
 global affv_url
  set pipe [open "|ncftp -u username -p password ftp.omgno.com" w]
  #puts $pipe "binary" -- not needed
  puts $pipe "put -f $localfile"
  #puts $pipe "quit" -- not needed
  close $pipe
  puthelp "PRIVMSG #channel : $affv_url"
  return 0
}
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Thu Oct 04, 2007 10:56 pm    Post subject: Reply with quote

enclose it in a catch function:
http://www.tcl.tk/man/tcl8.4/TclCmd/catch.htm
Evaluate script and trap exceptional returns
eg:

catch {set pipe [open "|ncftp -u username -p password ftp.omgno.com" w]
puts $pipe "put -f $localfile"
close $pipe
puthelp "PRIVMSG #channel : $affv_url"} error
return 0

Something like that.
Back to top
View user's profile Send private message
Devilion
Voice


Joined: 04 May 2005
Posts: 7

PostPosted: Fri Oct 05, 2007 4:55 am    Post subject: Reply with quote

Thank you!

I've been searching for a function like that, but I just couldn't find it.... but it works!

Thanks a lot Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber