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.

dcc to chan script

Old posts that have not been replied to for several years.
Locked
User avatar
EmOuBi
Voice
Posts: 9
Joined: Wed Nov 24, 2004 4:30 pm

dcc to chan script

Post by EmOuBi »

How to make this script to be startet with !send command in the channel ?

Code: Select all

bind dcc -|- send send_mail

proc send_mail {hand idx arg} {
    if {[llength $arg] < 2} {
	putdcc $idx "Usage: .send <mail> <message>"
	return 0
    }

    set mail [lindex $arg 0]
    if {![regexp \[@\] $mail]} {
	putdcc $idx "Usage: .send <foo@bar.com> <message>"
	return 0
    }
    foreach mailsend [whom *] {
    set user [lindex $mailsend 0]
    set message [lrange $arg 1 end]
    set msg "($user) $message"
    exec echo $msg | /var/qmail/bin/qmail-inject $mail
	
	}
}
putlog "Mail Send Loaded"
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you send the same email several times, each time flagging it with the bothandle of everyone who happens to be on the party line? that seems completely pointless to me, but anyway, here's a channel version:

Code: Select all

set mail /var/qmail/bin/qmail-inject
bind pub o !send send_mail
proc send_mail {n u h c t} {
  set t [split $t]
  if ![string match *@* [lindex $t 0]] {
    puthelp "notice $n :usage: [set ::lastbind] <foo@bar.com> <message>"
    return
  }
  exec echo "($h) [join [lrange $t 1 e]]" | $::mail [lindex $t 0]
  return 1
}
naturally, this will send out email only once per customer/command ;) or you would rather have it multiplied by the number of channel users? ;)
User avatar
EmOuBi
Voice
Posts: 9
Joined: Wed Nov 24, 2004 4:30 pm

Post by EmOuBi »

Thanks demond, it works perfect :wink:

Well, I want this script to be used for sending short, not so important e-mails. It's fasted then to log-in to your webmail and send it from there :wink:

Can I ask you another dummy question, will you modify the same script to work when someone type "send some@mail.com blaa" in private, querying the bot :oops: (bind msg I guess)
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

add this:

Code: Select all

bind msg o send send_msg
proc send_msg {n u h t} {
  send_mail $n $u $h dummy $t
}
Locked