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.

Need help with phone.tcl

Old posts that have not been replied to for several years.
Locked
s
sQuiZZ

Need help with phone.tcl

Post by sQuiZZ »

Hi

Can anybody help me with the script phone.tcl.
I should be quiet easy but when your are a n00b to tcl it isn't :D

The code is this.

Code: Select all

##################################################################
#Phone1.0.tcl By JaSonic						     #
#Allows users to set their phone no.s up on the bot              #
#AND can be displayed to a channel ONLY if permitted by the user #
##################################################################

bind msg h phone msg:phone
bind msg h home msg:home
bind msg h mobile msg:mobile
bind msg h office msg:office
bind msg h fax msg:fax
bind msg h sms msg:smsphone
bind pub o !phone pub:phone
bind dcc n phone dcc:phone

proc msg:phone {nick uhost handle arg} {
	global botnick
	set pass [lindex $arg 0]
	set top [lindex $arg 1]
	set phone [lrange $arg 2 end]
  	if {$pass == ""} {
  		putserv "PRIVMSG $nick :To set your phone details, pls do the following"
		putserv "PRIVMSG $nick :-----------------------------------------------"
		putserv "PRIVMSG $nick :To set your home phone, please do:-"
		putserv "PRIVMSG $nick :/msg $botnick phone <passwd> home <phone no.>"
		putserv "PRIVMSG $nick :To set your mobile phone, please do:-"
		putserv "PRIVMSG $nick :/msg $botnick phone <passwd> mobile <phone no.>"
		putserv "PRIVMSG $nick :To set your office phone, please do:-"
		putserv "PRIVMSG $nick :/msg $botnick phone <passwd> office <phone no.>"
		putserv "PRIVMSG $nick :To set your fax, please do:-"
		putserv "PRIVMSG $nick :/msg $botnick phone <passwd> fax <fax no.>"
		putserv "PRIVMSG $nick :To set your sms address, please do:-"
		putserv "PRIVMSG $nick :/msg $botnick phone <passwd> sms <address>"
		putserv "PRIVMSG $nick :To see your phone settings do:-"
		putserv "PRIVMSG $nick :/msg $botnick phone <passwd> me"
		putserv "PRIVMSG $nick :To see a users details if they permit it:-"
		putserv "PRIVMSG $nick :do !phone <handle> in chan"
		putserv "PRIVMSG $nick :==============================================="
		putserv "PRIVMSG $nick :All info you input is not displayed to channel "
		putserv "PRIVMSG $nick :unless otherwise stated by you and you alone   "
		putserv "PRIVMSG $nick :further details available as you set your no.s "
		return 0
  	} {
		if {[passwdok $handle $pass]} {
			if {$top == "me"} {
				set home [getuser $handle XTRA HOME]
				set mobile [getuser $handle XTRA MOBILE]
				set office [getuser $handle XTRA OFFICE]
				set fax [getuser $handle XTRA FAX]
				set sms [getuser $handle XTRA SMS]
				set homeyn [getuser $handle XTRA HOMEYN]
				set mobileyn [getuser $handle XTRA MOBILEYN]
				set officeyn [getuser $handle XTRA OFFICEYN]
				set faxyn [getuser $handle XTRA FAXYN]
				set smsyn [getuser $handle XTRA SMSYN]
				putserv "PRIVMSG $nick :Your current phone settings are as follows"
				putserv "PRIVMSG $nick :------------------------------------------"
				putserv "PRIVMSG $nick :HOME:   $home | Visible:  $homeyn"
				putserv "PRIVMSG $nick :MOBILE: $mobile | Visible:  $mobileyn"
				putserv "PRIVMSG $nick :OFFICE: $office | Visible:  $officeyn"
				putserv "PRIVMSG $nick :FAX:    $fax | Visible:  $faxyn"
				putserv "PRIVMSG $nick :SMS:    $sms | Visible:  $smsyn"
			} {
				if {$top == "home"} {
					setuser $handle XTRA HOME $phone
					putserv "NOTICE $nick :Home No. set to $phone"
					putserv "NOTICE $nick :To state whether people can see your home no. or not, pls type /msg $botnick home <passwd> yes/no"
					set home [getuser $handle XTRA HOMEYN]
					if {$home == ""} {
						setuser $handle XTRA HOMEYN "no"
					}
				} {
					if {$top == "mobile"} {
						setuser $handle XTRA MOBILE $phone
						putserv "NOTICE $nick :Mobile No. set to $phone"
						putserv "NOTICE $nick :To state whether people can see your mobile no. or not, pls type /msg $botnick mobile <passwd> yes/no"
						set mobile [getuser $handle XTRA MOBILEYN]
						if {$mobile == ""} {
							setuser $handle XTRA MOBILEYN "no"
						}
					} {
						if {$top == "office"} {
							setuser $handle XTRA OFFICE $phone
							putserv "NOTICE $nick :Office No. set to $phone"
							putserv "NOTICE $nick :To state whether people can see your office no. or not, pls type /msg $botnick office <passwd> yes/no"
							set office [getuser $handle XTRA OFFICEYN]
							if {$office == ""} {
								setuser $handle XTRA OFFICEYN "no"
							}
						} {
							if {$top == "fax"} {
								setuser $handle XTRA FAX $phone
								putserv "NOTICE $nick :Fax No. set to $phone"
								putserv "NOTICE $nick :To state whether people can see your fax no. or not, pls type /msg $botnick fax <passwd> yes/no"
								set fax [getuser $handle XTRA FAXYN]
								if {$fax == ""} {
									setuser $handle XTRA FAXYN "no"
								}
							} {
								if {$top == "sms"} {
									setuser $handle XTRA SMS $phone
									putserv "NOTICE $nick :Sms address set to $phone"
									putserv "NOTICE $nick :To state whether people can see your sms address or not, pls type /msg $botnick sms <passwd> yes/no"
									set smsyn [getuser $handle XTRA SMSYN]
									if {$smsyn == ""} {
										setuser $handle XTRA SMSYN "no"
									}
								} {putserv "NOTICE $nick :Sorry, I dont recognise that phone type, please user either home, mobile, office, fax or sms"}
							}
						}
					}
				}
			}
		} {putserv "NOTICE $nick :Invalid Password"}
	}

}

proc msg:home {nick uhost handle arg} {
	global botnick
	set pass [lindex $arg 0]
	set yn [lindex $arg 1]
	if {[passwdok $handle $pass]} {
		if {($yn == "yes") || ($yn == "no")} {
			setuser $handle XTRA HOMEYN $yn
			putserv "NOTICE $nick :Allowing users to see your home phone no.: $yn"
		} { putserv "NOTICE $nick :Command not performed, pls do /msg $botnick home <passwd> yes/no" }
	} {putserv "NOTICE $nick :Invalid Password"}
}

proc msg:mobile {nick uhost handle arg} {
	global botnick
	set pass [lindex $arg 0]
	set yn [lindex $arg 1]
	if {[passwdok $handle $pass]} {
		if {($yn == "yes") || ($yn == "no")} {
			setuser $handle XTRA MOBILEYN $yn
			putserv "NOTICE $nick :Allowing users to see your mobile phone no.: $yn"
		} { putserv "NOTICE $nick :Command not performed, pls do /msg $botnick mobile <passwd> yes/no" }
	} {putserv "NOTICE $nick :Invalid Password"}
}

proc msg:office {nick uhost handle arg} {
	global botnick
	set pass [lindex $arg 0]
	set yn [lindex $arg 1]
	if {[passwdok $handle $pass]} {
		if {($yn == "yes") || ($yn == "no")} {
			setuser $handle XTRA OFFICEYN $yn
			putserv "NOTICE $nick :Allowing users to see your office phone no.: $yn"
		} { putserv "NOTICE $nick :Command not performed, pls do /msg $botnick office <passwd> yes/no" }
	} {putserv "NOTICE $nick :Invalid Password"}
}

proc msg:fax {nick uhost handle arg} {
	global botnick
	set pass [lindex $arg 0]
	set yn [lindex $arg 1]
	if {[passwdok $handle $pass]} {
		if {($yn == "yes") || ($yn == "no")} {
			setuser $handle XTRA FAXYN $yn
			putserv "NOTICE $nick :Allowing users to see your fax phone no.: $yn"
		} { putserv "NOTICE $nick :Command not performed, pls do /msg $botnick fax <passwd> yes/no" }
	} {putserv "NOTICE $nick :Invalid Password"}
}

proc msg:smsphone {nick uhost handle arg} {
	global botnick
	set pass [lindex $arg 0]
	set yn [lindex $arg 1]
	if {[passwdok $handle $pass]} {
		if {($yn == "yes") || ($yn == "no")} {
			setuser $handle XTRA SMSYN $yn
			putserv "NOTICE $nick :Allowing users to see your sms address: $yn"
		} { putserv "NOTICE $nick :Command not performed, pls do /msg $botnick sms <passwd> yes/no" }
	} {putserv "NOTICE $nick :Invalid Password"}
}

proc pub:phone {nick uhost handle chan arg} {
	set auth [getuser $handle XTRA AUTH]
	if {$auth == "0"} {
		set person [lindex $arg 0]
		set home [getuser $person XTRA HOME]
		set mobile [getuser $person XTRA MOBILE]
		set office [getuser $person XTRA OFFICE]
		set fax [getuser $person XTRA FAX]
		set sms [getuser $person XTRA SMS]
		putserv "PRIVMSG $chan :Phone details for $person"
		putserv "PRIVMSG $chan :========================="
		set homeyn [getuser $person XTRA HOMEYN]
		if {$homeyn == "no"} {
			putserv "PRIVMSG $chan :HOME: Classified"
		} {
			putserv "PRIVMSG $chan :HOME: $home"
		}
		set mobileyn [getuser $person XTRA MOBILEYN]
		if {$mobileyn == "no"} {
			putserv "PRIVMSG $chan :MOBILE: Classified"
		} {
			putserv "PRIVMSG $chan :MOBILE: $mobile"
		}
		set officeyn [getuser $person XTRA OFFICEYN]
		if {$officeyn == "no"} {
			putserv "PRIVMSG $chan :OFFICE: Classified"
		} {
			putserv "PRIVMSG $chan :OFFICE: $office"
		}
		set faxyn [getuser $person XTRA FAXYN]
		if {$faxyn == "no"} {
			putserv "PRIVMSG $chan :FAX: Classified"
		} {
			putserv "PRIVMSG $chan :FAX: $fax"
		}
		set smsyn [getuser $person XTRA SMSYN]
		if {$smsyn == "no"} {
			putserv "PRIVMSG $chan :SMS: Classified"
		} {
			putserv "PRIVMSG $chan :SMS: $sms"
		}
	} {putserv "NOTICE $nick :you are not authorised to do that"}
}

proc dcc:phone {hand idx arg} {
	set person [lindex $arg 0]
  	if {$person == ""} {
    		putdcc $idx "Usage: .phone <handle>"
		return 0
  	}
	set home [getuser $person XTRA HOME]
	set homeyn [getuser $person XTRA HOMEYN]
  	if {$home == ""} {
    		putdcc $idx "$person has no home no. set"
  	} {
		putdcc $idx "$person HOME: $home | Visible: $homeyn"
	}
	set mobile [getuser $person XTRA MOBILE]
	set mobileyn [getuser $person XTRA MOBILEYN]
  	if {$mobile == ""} {
    		putdcc $idx "$person has no mobile no. set"
  	} {
		putdcc $idx "$person MOBILE: $mobile | Visible: $mobileyn"
	}
	set office [getuser $person XTRA OFFICE]
	set officeyn [getuser $person XTRA OFFICEYN]
  	if {$office == ""} {
    		putdcc $idx "$person has no office no. set"
  	} {
		putdcc $idx "$person OFFICE: $office | Visible: $officeyn"
	}
	set fax [getuser $person XTRA FAX]
	set faxyn [getuser $person XTRA FAXYN]
  	if {$fax == ""} {
    		putdcc $idx "$person has no fax no. set"
  	} {
		putdcc $idx "$person FAX: $fax | Visible: $faxyn"
	}
	set sms [getuser $person XTRA SMS]
	set smsyn [getuser $person XTRA SMSYN]
  	if {$sms == ""} {
    		putdcc $idx "$person has no sms set"
  	} {
		putdcc $idx "$person SMS: $sms | Visible: $smsyn"
	}
}

putlog "phone.tcl loaded on $botnick by JaSonic"
I have change this.

Code: Select all

bind pub o !phone pub:phone
from this

Code: Select all

bind pub v|v !phone pub:phone
This was because i only wanted OP's to be able to use the script.

and this

Code: Select all

if {$auth == "0"} {
from this

Code: Select all

if {$auth == "1"} {
This i changed because i tried to get around this error message.
{17|19|04} -|TpE-cs|- you are not authorised to do that
I got that error message when i tried to see some of the numbers on the user.
But no can do....

I can add the numbers to the user with out any problems.
The help text doesn't work either... :(
Can anybody tell me how i do get AUTH to the phone script.

I hope some of you guys can help me.

Thanks
sQuiZZ
s
sQuiZZ

Post by sQuiZZ »

Is it because of my long post, that nobody has answered me. :(
Sry about that then, but when i want to help somebody i want as much info as possible.

So please help if you can. :)

Thanks
sQuiZZ
User avatar
z_one
Master
Posts: 269
Joined: Mon Jan 14, 2002 8:00 pm
Location: Canada

Post by z_one »

getuser <handle> XTRA <key>
to receive data set for a certain key

setuser <handle> XTRA <key> <data>
sets upto 500 bytes of data per key (use no data to clear)
I don't know how much this will help you but at least try reading it.
You need to know where the "data set" for the key AUTH is being written.
Since the script is using getuser then setuser must have been used somewhere to set the key AUTH.
That is the only way you will know what possible value it may hold.
You tried 1 instead of 0 but that is not the only value it can hold, it can be 23 or 4562 or anything else.
s
soul
Voice
Posts: 31
Joined: Fri Apr 25, 2003 6:25 pm
Location: Portugal

Post by soul »

1) change auth var back to 1

2) add the code below to the script

Code: Select all

bind msg o auth msg:auth
proc msg:auth {nick uhost hand arg} {
set pass [lindex $arg 0]
if {[passwdok $hand $pass]} { set auth "1" }
}
PS. this is not the perfect solution, you should use flag cookie
ie: auth messaging adds a flag and a part and quit bind that erase flag
i'll believe in justice when the pope is accused {
if {$true == "$censured" }{return nothing}}
Locked