Jump to content

Whisper Accept Or Decline


CharmedOne

Recommended Posts

Just tested it on Buzzen, and it does work. Here is something else I was working on that you can use too if you wish. It is a combination of the previous code along with a message center addon for when you are away. :)

 

on *:TEXT:*:?: {
;This code will set the incoming text for future use.
  set %wtext. [ $+ [ $nick ] ] $nick $+ : $1-
  if (!%awaymsg) {
;%awaymsg is used to determine if the code utilizes the Message Center (Used when you are away), or if you're not away it will use the whisper access instead.
    if (!%wnick. [ $+ [ $nick ] ]) {
       .msg $nick Waiting for $me to accept whisper, please wait...
      .closemsg $nick
      dialog -md waccept. $+ $nick waccept
    }
  }
  else {
    .msg $nick I'm away right now. Your message has been copied, and will be read when I return. Thank you.
    write $nofile($mircexe) $+ messages.txt $date(mm/dd/yyyy) $time(hh:nn:ss) %wtext. [ $+ [ $nick ] ]
    .closemsg $nick
  }
}

on *:close:?: if (%wnick. [ $+ [ $nick ] ]) unset %wnick. [ $+ [ $nick ] ]

dialog MSGS {
  title "Message Center:"
  size -1 -1 341 252
  option dbu
  list 1, 2 12 89 225, size
  text "Messages From:", 2, 2 2 88 8, center
  text "Read Message From:", 3, 94 2 244 8, center
  list 4, 94 12 244 225, size
  button "Close:", 5, -1 240 343 12
}

;The following is used for your Message Center.
on *:dialog:msgs:*:*: {
  if ($devent == init) {
    :If on init this code will gather a list of names who sent you messages.
    var %l = 1
    while (%l <= $lines($nofile($mircexe) $+ messages.txt)) {
      if (!$didwm($dname,1,$left($gettok($read($nofile($mircexe) $+ messages.txt,%l),3,32),-1))) did -a $dname 1 $left($gettok($read($nofile($mircexe) $+ messages.txt,%l),3,32),-1)
      inc %l
    }
  }
;When you click on each name it will show you a list of messages that person sent you.
  if ($devent == sclick) {
    if ($did == 1) {
      did -r $dname 4
      did -ra $dname 2 Messages From: $did(1).seltext
      did -ra $dname 3 Read Message From: $did(1).seltext
      var %s = 1
      while (%s <= $lines($nofile($mircexe) $+ messages.txt)) {
        if ($left($gettok($read($nofile($mircexe) $+ messages.txt,%s),3,32),-1) == $did(1).seltext) did -a $dname 4 $chr(40) $+ $gettok($read($nofile($mircexe) $+ messages.txt,%s),1-2,32) $+ $chr(41) $gettok($read($nofile($mircexe) $+ messages.txt,%s),4-,32)
        inc %s
      }
    }
    elseif ($did == 5) dialog -c $dname $dname
  }
;When you close the Message Center it will ask you if you want to delete all messages. If you click OK it will delete all messages that was sent you.
  if ($devent == close) {
    if ($input(Do you want to delete your messages?,y,Message Center:) == $true) .remove $nofile($mircexe) $+ messages.txt
  }
}

;The following dialog is used just like an $input event. It will ask you if you want to accept an incoming whisper from someone. If you don't want to just click the No button. It will send a message to the person saying their whisper to you has been denied. Otherwise if you accept the whisper it will open the whisper window, and echo what was said. It will also let the person know you have accepted their whisper, and to continue.
dialog waccept {
  title "Whisper From: "
  size -1 -1 134 45
  option dbu
  button "Yes", 1, 28 31 37 12
  button "No", 2, 68 31 37 12
  text "", 3, 1 1 131 28
}

;The following lets your script know whether to use the Message Center when you're away, or not.
raw *:*: {
  if ($network != Buzzen) {
    if ($numeric == 306) set %awaymsg $true
    if ($numeric == 305) {
      unset %awaymsg
      if ($exists($nofile($mircexe) $+ messages.txt)) dialog -md msgs msgs
    }
  }
  else {
    if ($numeric == 822) set %awaymsg $true
    if ($numeric == 821) {
      unset %awaymsg
      if ($exists($nofile($mircexe) $+ messages.txt)) dialog -md msgs msgs
    }
  }
}

;The following code is used just like an $input event. It will ask you if you want to accept an incoming whisper from someone. If you don't want to just click the No button. It will send a message to the person saying their whisper to you has been denied. Otherwise if you accept the whisper it will open the whisper window, and echo what was said. It will also let the person know you have accepted their whisper, and to continue.
on *:dialog:waccept*:*:*: {
  tokenize 32 $gettok($dname,2,$asc(.))
  if ($devent == init) {
    dialog -t $dname Whisper from $1- $+ ?
    did -ra $dname 3 Do you want to accept incoming whisper from $1- $+ ?
  }
  if ($devent == sclick) {
    if ($did == 1) {
      set %wnick. [ $+ [ $1- ] ] $1-
      query %wnick. [ $+ [ $1- ] ]
      .msg %wnick. [ $+ [ $1- ] ] Your whisper has been accepted, please continue.
      echo %wnick. [ $+ [ $1- ] ] %wtext. [ $+ [ $1- ] ]
      dialog -c $dname waccept
    }
    if ($did == 2) {
      .msg $1- Access to whisper has been denied.
      closemsg $1-
      dialog -c  $dname waccept
    }
  }
}

Edited by Warrior124
Link to comment
Share on other sites

he wasn't saying it wouldn't work that way.. what travis was saying is that buzzen uses raw data to accomplish what you are doing.

 

;err0r whispering err0r1885
;example sending request
<- :err0r1885!6492d38d732122c58b44e3fdc3e9e9f3@BuzzenPassport DATA %#err0rtest err0r CMWHISP :WHISPACCEPTNEEDED
;example request accepted
<- :err0r1885!6492d38d732122c58b44e3fdc3e9e9f3@BuzzenPassport DATA %#err0rtest err0r CMWHISP :WHISPACCEPTED
;example user declined
<- :err0r1885!6492d38d732122c58b44e3fdc3e9e9f3@BuzzenPassport DATA %#err0rtest err0r CMWHISP :WHISPDECLINED
;example user closed query window
<- :err0r1885!6492d38d732122c58b44e3fdc3e9e9f3@BuzzenPassport DATA %#err0rtest err0r CMWHISP :WHISPWNDCLOSED

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...