Really simple query dialog that pops up when someone msgs you. It gives you the option to add a user to a friends list so that it automatically ignores the dialog if the user is in the friends list. You also have the option to remove a friend from the list by typing /del_nick (nick). Editing is fine, just give proper credit or a link to this snippet.
dialog quer_ {
title "Query forwarding"
size -1 -1 105 62
option dbu
box "", 1, 2 1 101 60, disable
button "Yes", 4, 6 42 23 12
button "No", 5, 29 42 23 12
button "Add as friend", 6, 52 42 35 12
edit "", 3, 7 21 87 17, read vsbar
edit "", 2, 8 8 86 10, read
}
on *:dialog:quer_:init:0:{
did -a $dname 2 Query from %nick_
did -a $dname 3 Saying: %message_
}
on *:dialog:quer_:sclick:*:{
if ($did = 4) {
unset %message_
dialog -x quer_ quer_
query %nick_
.msg %nick_ Your query has been accepted.
unset %nick_
}
if ($did = 5) {
unset %message_
dialog -x quer_ quer_
.msg %nick_ Your query has been declined.
unset %nick_
}
if ($did = 6) {
if (!$hget(query)) hmake query 500
.hadd -m query %nick_ Friend.
dialog -x quer_ quer_
query %nick_
.msg %nick_ Your query has been accepted and you are now added to the acceptance list.
unset %message_ %nick_
}
}
on *:open:?:{
if ($hget(query,$nick) = Friend.) halt
else {
set %nick_ $nick
set %message_ $1-
dialog -m quer_ quer_
.close -m %nick_
}
}
alias del_nick {
if ($hget(query)) {
if ($1) && ($hget(query,$1)) {
hdel query $1
}
}
}
on *:EXIT:{
if ($hget(query)) {
hsave -o query query.hsh
}
}
on *:START:{
if (!$hget(query)) hmake query 500
hload query query.hsh
}
Ah the notheme, I use a program called deditor because I am way too lazy. It pretty much includes that usually and I forgot to filter that out. =/
And about the load, the events were last minute and not tested. I am sorry for the efficiency of the snippet right now and will get to work immediately. Thank you all for your feedback.