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.

any help appreciated :)

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
P
PaulyboyUK
Voice
Posts: 12
Joined: Thu Oct 09, 2008 6:45 pm

any help appreciated :)

Post by PaulyboyUK »

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 :)
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

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: Select all

set filelist [list file1 file2]
...or generate a list of all the files in a particular directory using glob

Code: Select all

set filelist [glob -dir /path/to/dir/containing/your/files -type f *]
Make a proc to send all the files to one user

Code: Select all

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: Select all

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"?
P
PaulyboyUK
Voice
Posts: 12
Joined: Thu Oct 09, 2008 6:45 pm

Post by PaulyboyUK »

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? ......
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

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: Select all

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"?
P
PaulyboyUK
Voice
Posts: 12
Joined: Thu Oct 09, 2008 6:45 pm

Post by PaulyboyUK »

TY TY TY - spot on and a gr8 start 4 me youare a star :)
P
PaulyboyUK
Voice
Posts: 12
Joined: Thu Oct 09, 2008 6:45 pm

Post by PaulyboyUK »

Code: Select all



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
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

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: Select all

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.
P
PaulyboyUK
Voice
Posts: 12
Joined: Thu Oct 09, 2008 6:45 pm

Post by PaulyboyUK »

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: Select all

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"
}
}

P
PaulyboyUK
Voice
Posts: 12
Joined: Thu Oct 09, 2008 6:45 pm

Post by PaulyboyUK »

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
Post Reply