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 

reading from a website

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


Joined: 09 Jan 2004
Posts: 48
Location: USA

PostPosted: Fri Dec 09, 2005 8:31 pm    Post subject: reading from a website Reply with quote

Is it possible to read a script from a website. Such as unreal ircd has remote includes function. can this be done by the bot or no?
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Dec 10, 2005 1:31 am    Post subject: Reply with quote

yes

see any autoupdated script, for example spambuster
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
LiquidIce
Halfop


Joined: 09 Jan 2004
Posts: 48
Location: USA

PostPosted: Sat Dec 10, 2005 10:19 pm    Post subject: Reply with quote

is it possible to read a tcl from website http://blah.net/somescript.tcl

source http://blah.net/somescript.tcl
???
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Sun Dec 11, 2005 12:42 am    Post subject: Reply with quote

not directly, but you could use http::geturl to get the script and eval its content.

Code:
package require http 2.4

::http::geturl {http://blah.net/somescript.tcl} -command httploadscript

proc httploadscript {token} {
   if {[::http::ncode $token] == 200} {
       uplevel #0 [::http::data $token]
   } else {
       putlog "Failed to load file from website: [::http::error $token]"
   }
   ::http::cleanup $token
   return 0
}

use at your own risk, since if the content of the site changes and contains some bad code, someone might be able to takeover your bot.
Also note that the script will be loaded asyncron, meaning it will most likely be loaded at last (so put all source commands that require that script to be already loaded after the eval line).

Edit: eval -> uplevel like demond mentioned.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...


Last edited by De Kus on Sun Jan 08, 2006 10:25 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Dec 11, 2005 3:37 am    Post subject: Reply with quote

De Kus wrote:

Code:

       eval [::http::data $token]



that won't work as intended, you are evaluating in a proc, not in the global context in which that script most likely expects to be evaluated; use [uplevel]
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
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