I was hoping somebody would be able to create a script for me that listens for a privmsg invite with a password (ie. /msg bot invite username password or /msg bot username password invite). It would then compare the username and password to a mysqldb to see if they match. If they both match then an invite to the channel is given to the requesting nick, if either are wrong a simple wrong user/pass msg is sent to the nick requesting the invite.
# Author: tomekk
# e-mail: tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
# command: /msg botnick invite <username> <password>
# invite channel
set invite_chan "#channel"
# mysql db user
set msql_user "user"
# mysql db pass
set msql_pass "pass"
# mysql server host
set msql_host "localhost"
# mysql usernames/passwords database
set msql_dbase "eggdrop_users"
# mysql usernames/passwords table
set msql_table "users"
##################################################################
bind msgm - "*" invite_privs
package require mysqltcl
proc invite_privs { nick uhost hand arg } {
global msql_user msql_pass msql_host msql_dbase msql_table invite_chan
set all_prv_args [split $arg]
set priv_command [lindex $all_prv_args 0]
set priv_username [lindex $all_prv_args 1]
set priv_password [lindex $all_prv_args 2]
set login_ok 0
if {($priv_command == "invite") && ($priv_username != "") && ($priv_password != "")} {
set m_hand [::mysql::connect -host $msql_host -user $msql_user -password $msql_pass]
::mysql::use $m_hand $msql_dbase
set users_passwords [::mysql::sel $m_hand "SELECT username, password FROM $msql_table" -list]
::mysql::close $m_hand
foreach u_and_p $users_passwords {
if {$u_and_p != ""} {
set u_and_p_split [split $u_and_p]
set user_name [lindex $u_and_p_split 0]
set user_pass [lindex $u_and_p_split 1]
if {$priv_username == $user_name} {
if {$priv_password == $user_pass} {
set login_ok 1
}
}
}
}
if {$login_ok == 0} {
putquick "PRIVMSG $nick :wrong username or wrong password, sorry"
} {
putserv "INVITE $nick $invite_chan"
}
}
}
putlog "mysql_invite.tcl ver 0.1 by tomekk loaded"