| View previous topic :: View next topic |
| Author |
Message |
PaulyboyUK Voice
Joined: 09 Oct 2008 Posts: 12
|
Posted: Thu Oct 09, 2008 6:52 pm Post subject: any help appreciated :) |
|
|
i have searched and as yet cannot even find a script that does half what i need - am trying to learn tcl but long journey for me - heres what i am looking to do !
on a private channel i want to be able to send a complete folder of files to a list of users - i nned to be able to view - and mange those users - ie with something like !viewusrs to see all users in a list , !delusr !addusr etc
also abiltiy to selct folder to send - not just file it need to be a complete folder - if has to be fixed then fair enough!
i already have something similar in a mirc script - but cant seem to begin starting to create in tcl script!! any ideas? any help really appreciated - any further info needed just ask
ty in anticipation
Paul  |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Fri Oct 10, 2008 3:22 am Post subject: |
|
|
First, make sure you've loaded and set up the filesys and transfer modules correctly.
Do you want to initiate the sending or will the users do it on their own?
If the users will initiate the sending, why not give them partyline and file system access? (saves you some coding)
If you want to initiate the sending or don't want to give them partyline access, add the users to your bot and give them a custom flag (eg. .chattr user +F)
Make a list of files to send... either by hand...
| Code: | | set filelist [list file1 file2] |
...or generate a list of all the files in a particular directory using glob
| Code: | | set filelist [glob -dir /path/to/dir/containing/your/files -type f *] |
Make a proc to send all the files to one user
| Code: | proc sendfiles {nick} {
foreach file $::filelist {
dccsend $nick $file
}
} |
If YOU want to initiate the sending, find all users that have the flag and are currently on irc:
| Code: |
foreach user [userlist F] {
if {[set nick [hand2nick $user]]!=""} {
sendfiles $nick
}
}
|
If the user will initiate the send themselves, just make sure you include the flag in the bind they use to start the transfer. _________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
PaulyboyUK Voice
Joined: 09 Oct 2008 Posts: 12
|
Posted: Sun Oct 12, 2008 6:42 am Post subject: |
|
|
| thanks for this - trying my best - will keep plugging away - any other input really appreciated - also thtanother way i could use would be when i send a file to the bot it sends that file out to a list of users - is this do-able? ...... |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Wed Oct 15, 2008 6:46 am Post subject: |
|
|
Set up the filesys and transfer modules, put your handle in the bind and load the script below, add users and give them the F flag (uppercase F), then send a file to your bot to test it. (it will only send copies of the file to users that are visible to the bot at the time you completed your transfer - and I didn't test it, so it might have bugs)
| Code: | bind rcvd - PUT_YOUR_OWN_HANDLE_HERE gotFile
proc gotFile {h n f} {
foreach hand [userlist F] {
if {[set nick [hand2nick $hand]]!=""} {
switch [dccsend $f $nick] {
1 {set msg "the dcc table is full (too many connections)"}
2 {set msg "can't open a socket for the transfer"}
3 {set msg "the file doesn't exist"}
default continue
}
putlog "Error sending $f to $nick ($hand): $msg"
}
}
} |
_________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
PaulyboyUK Voice
Joined: 09 Oct 2008 Posts: 12
|
Posted: Fri Oct 17, 2008 6:10 pm Post subject: |
|
|
TY TY TY - spot on and a gr8 start 4 me youare a star  |
|
| Back to top |
|
 |
PaulyboyUK Voice
Joined: 09 Oct 2008 Posts: 12
|
Posted: Sun Oct 19, 2008 7:23 pm Post subject: |
|
|
| Code: |
bind rcvd - Paulyboy gotFile
proc gotFile {h n f} {
set txt [open nickplus.txt]
set list [read $txt]
close $txt
foreach x $list {
if {[set nick $x]!=""} {
switch [dccsend $f $nick] {
1 {set msg "the dcc table is full (too many connections)"}
2 {set msg "can't open a socket for the transfer"}
3 {set msg "the file doesn't exist"}
default continue
}
putlog "Error sending $f to $nick ($x): $msg"
}
}
putserv "PRIVMSG $nick i have sent you $f thankyou"
}
|
the above code seems to work ok - i wanted the bot to sent a pm tpo me and the user it sends the file to once the file is complete - however it does pm the user ( Havent added my pm bit yet) however it shows the full path to the file ie > i have sent you /home/myirc/botroom/mybot/filesys/incoming/test.zip.rar thankyou
is there a way to remove the directories so it just shows the filename?
also excuse the code fomatting etc - its my first go at this hope to get better as time goes on
Thankyou in anticipation
Paul |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sun Oct 19, 2008 8:10 pm Post subject: |
|
|
| PaulyboyUK wrote: | is there a way to remove the directories so it just shows the filename?
also excuse the code fomatting etc - its my first go at this hope to get better as time goes on
Thankyou in anticipation
Paul |
| Code: | | putserv "PRIVMSG $nick :I have sent you [lindex [split $f "/"] end] thankyou" |
You failed to include that : in your posted code, it is required for privmsg to function. First split the entire thing by slashes, then lindex the very last position to get only the filename. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
PaulyboyUK Voice
Joined: 09 Oct 2008 Posts: 12
|
Posted: Mon Oct 20, 2008 1:36 pm Post subject: |
|
|
thankyou - tht was spot on - is there anyway to msg both the sender and the person who is revieving the file to show it sent ok? - i assume that the number returning from dcc send is 0 - i tried but when it sends to say 5 people it only sends the pm to the last person receiving the file
ty so much for the help -
| Code: |
bind rcvd - paulyboy gotFile
proc gotFile {h n f} {
set txt [open nickplus.txt]
set list [read $txt]
close $txt
foreach x $list {
if {[set nick $x]!=""} {
switch [dccsend $f $nick] {
0 {set msg "CDClub has sent [lindex [split $f "/"] end] to $nick"}
1 {set msg "the dcc table is full (too many connections)"}
2 {set msg "can't open a socket for the transfer"}
3 {set msg "the file doesn't exist"}
default continue
}
putserv "PRIVMSG $nick :I am sending you [lindex [split $f "/"] end] Please do not release until Ad in channel, Thankyou"
}
putserv "PRIVMSG paulyboy : $msg"
}
}
|
|
|
| Back to top |
|
 |
PaulyboyUK Voice
Joined: 09 Oct 2008 Posts: 12
|
Posted: Tue Oct 21, 2008 4:17 am Post subject: |
|
|
hi guys
Ignore previous post it seems to be working now - however i think when it runs the loop for the list i.e foreach x $list it obv runs very quickly so all dl start at same time - i tried to add a timer command in body of program which worked as in each dl started a minute after the previous - i saw this while i was in dcc chat with the bot - however it never sent the file or pm me or the user who i sent files to - also at the end it seemed to then spit out a timer split error and disconnect the bot - then reconnect
is there a way to slow that foreach loop?
or is there a way to say read the first 5 users - send file then read next 5 etc until the list is complete - i assume this is a major upgrade but with all the people getting the file at same time it hogs the server
thanks for input
Paul |
|
| Back to top |
|
 |
|