S.A. Inbox Messaging System v.3.0.0.0

By Tamaki on May 21, 2009

This is the standalone version of the Inbox Messaging System Module. This script does not require the use of the updated TAD's Integration Script.

After installation, you can use, pretty much however you want. You can register yourself by messaging yourself. Everyone else can message you or type it in any channel you are on.

Usage is !inbox

-edit-

In the new version of the script, I took out that annoying, every channel advert thingy. So now it's safe to use accross all servers, b/c it only works on the channel you specify.

Another thing, I've made a whole bunch of commands activate as local commands, why? Because I realized local commands will process faster than activated scripts.

If you have any other features you'd like for me to add, simply come to my server and have a chat with me.

/server -m irc.authoritygamer.com -j #authoritygamer

-edit-

In the update, I fixed the manual account creation. Users can now register their own accounts via PM.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;The_Almighty_Duelist's Scripts;;;;;;
;;;;;Standalone Inbox Message Service;;;;;
;;;;;;;;;;;;;;;;v.3.0.0.0;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;Loading and Starting;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

on *:LOAD: {
  writeini mail.ini settings channel $$?="Please enter the channel you are going to be using this on."
  echo -a Thank you for choosing one of my scripts! To set specific inbox options, type /inbox | titlebar (C)2009 DJ Bill Enterprizes
}

on *:START: {
  echo -a Just a little reminder for you, type /inbox to set inbox specific options | titlebar (c)2009 DJ Bill Enterprizes
  titlebar $chr(169) $+ 2009 DJ Bill Enterprizes
}

;;;;;;;;;;;;;;;;;
;;;;;aliases;;;;;
;;;;;;;;;;;;;;;;;

alias umail {
  If ($1 == $null) echo -a Error $umail: Not enough parameters
  If ($readini(mail.ini,$1,registered) == yes) return $readini(mail.ini,$1,messages)
}

alias inbox {
  If ($1 == $null) {
    echo -a To set your specific inbox service channel: /inbox channel #channelhere
    echo -a To force an account to register: /inbox sudo make <account name> <password>
    echo -a To force an account to delete: /inbox sudo remove <acount name>
    echo -a To view a list of all current members and thier messages: /inbox members
    If ($readini(mail.ini,status,admin) == on) {
      echo -a To view a list of all admin messages: /inbox admin view
      echo -a To turn the admin messaging option off: /inbox admin off
    }
    Else {
      echo -a To turn the admin messaging option on: /inbox admin on
    }
  }
  Else {
    If ($1 == channel) {
      If ($2 == $null) {
        echo -a Please type /inbox channel <your channel here>
      }
      Else {
        writeini mail.ini settings channel $2-
        echo -a Channel changed to $2-
      }
    }
    If ($1 == sudo) {
      If ($2 == make) {
        If ($4 == $null) {
          echo -a Please type $1 $2 <account name> <password>
        }
        Else {
          If ($readini(mail.ini,$3,registered) != yes) {
            writeini mail.ini $3 registered yes
            writeini mail.ini $3 password $4-
            writeini mail.ini $3 logged_in yes
            writeini mail.ini $3 ignore no
            writeini mail.ini $3 newmail yes
            writeini mail.ini $3 messages 1
            write $3 $+ mail.txt From: Admin Date: $asctime(ddmmmyy) Time: $asctime(hh:nn:ss TT) Message: Thank you for choosing our inbox messaging system. To explore further options, type !mail
            $iif($3 ison $mailchan,.msg $3 You have a new message in your !inbox,)
            writeini mail.ini status members $calc($readini(mail.ini,status,members) + 1)
            write mail.txt $3
            echo -a Account created and mail sent.
          }
          Else {
            echo -a $3 is already registered!
          }
        }
      }
      If ($2 == remove) {
        If ($3 == $null) {
          echo -a Please type $1 $2 <account name>
        }
        Else {
          If ($readini(mail.ini,$3,registered) == yes) {
            remini mail.ini $3
            .remove $3 $+ mail.txt
            $iif($3 ison $mailchan,.msg $3 Your account has been deleted.,)
            writeini mail.ini status members $calc($readini(mail.ini,status,members) - 1)
            write -ds $+ $3 mail.txt
            echo -a Account has been deleted.
          }
          Else {
            echo -a There is no such account!
          }
        }
      }
    }
    If ($1 == admin) {
      If ($2 == on) || ($2 == off) {
        writeini mail.ini status admin $2
        echo -a Admin messaging has been turned $2 $+ .
      }
      Elseif ($2 == view) {
        dialog -md viewadmin viewadmin
      }
      Else {
        echo -a Unknown command.
      }
    }
    If ($1 == members) {
      dialog -md members members
    }
  }
}

alias mailchan {
  return $readini(mail.ini,settings,channel)
}

alias mail {
  If ($2 == inbox) {
    writeini mail.ini $1 newmail no
    If ($3 == all) {
      var %temp.1 1
      var %temp.2 $readini(mail.ini,$1,messages)
      var %temp.3 1
      .msg $1 Welcome to your inbox! Please be patient while I display your messages, I will tell you when I'm finished.
      While (%temp.1 <= %temp.2) {
        If ($read($1 $+ mail.txt, %temp.1) != $null) {
          .timer 1 %temp.3 .msg $1 Message %temp.1 $read($1 $+ mail.txt, %temp.1)
          inc %temp.3
        }
        inc %temp.1
      }
      .timer 1 %temp.3 .msg $1 That's it! If you would like to delete a message, type !delete <message number> or type !delete all to delete all your messages!
    }
    If ($3 isnum) {
      If ($read($1 $+ mail.txt, $3) != $null) {
        .msg $1 Here is your message number $3 $+ :
        .msg $1 $read($1 $+ mail.txt, $3)
        .msg $1 If you would like to delete this message, type !delete $3
      }
      Else {
        .msg $1 There is no message number $3 $+ !
      }
    }
  }
  If ($2 == send) {
    writeini mail.ini $3 newmail yes
    writeini mail.ini $3 messages $calc($umail($3) + 1)
    write $3 $+ mail.txt From: $1 Date: $asctime(ddmmmyy) Time: $asctime(hh:nn:ss TT) Message: $4-
    If ($readini(mail.ini,$3,ingore) != yes) {
      If ($3 ison $mailchan) {
        .msg $3 You have new mail in your inbox, type !inbox $umail($3) to view it.
      }
    }
    .msg $1 Message has successfully been sent to $3
  }
  If ($2 == delete) {
    If ($3 == all) {
      writeini mail.ini $1 newmail no
      writeini mail.ini $1 messages 0
      remove $1 $+ mail.txt
      .msg $1 You have deleted all your messages.
    }
    If ($3 == account) {
      remini mail.ini $1
      remove $1 $+ mail.txt
      writeini mail.ini status members $calc($readini(mail.ini,status,members) - 1)
      write -ds $+ $1 mail.txt
      .msg $1 Your account has been deleted.
    }
    If ($3 isnum) {
      writeini mail.ini $1 messages $calc($umail($1) - 1)
      write -dl $+ $3 $1 $+ mail.txt
      .msg $1 Message number $3 has been deleted.
    }
  }
  If ($2 == settings) {
    If ($3 == password) {
      writeini mail.ini $1 password $4-
      .msg $1 Password successfully changed!
    }
    If ($3 == ignore) {
      writeini mail.ini $1 ignore $4
      .msg $1 Your ignore setting has been changed to: $4
    }
  }
  If ($2 == create) {
    writeini mail.ini $1 registered yes
    writeini mail.ini $1 password $3
    writeini mail.ini $1 logged_in yes
    writeini mail.ini $1 ignore no
    writeini mail.ini $1 newmail yes
    writeini mail.ini $1 messages 1
    write $1 $+ mail.txt From: Admin Date: $asctime(ddmmmyy) Time: $asctime(hh:nn:ss TT) Messages: Thank you for choosing the mail service on this channel! To see your options, type !mail
    writeini mail.ini status members $calc($readini(mail.ini,status,members) + 1)
    write mail.txt $1
    .msg $1 You have a new message in your inbox. Please type !inbox 1 to view it.
  }
}

;;;;;;;;;;;;;;;;
;;;;;Events;;;;;
;;;;;;;;;;;;;;;;

on *:JOIN:#: {
  If ($chan == $mailchan) {
    If ($readini(mail.ini,$nick,registered) == yes) {
      If ($readini(mail.ini,$nick,ignore) != yes) {
        notice $nick Welcome back $nick $+ !
        If ($readini(mail.ini,$nick,newmail) == yes) {
          notice $nick You have new mail! To view your inbox, type !inbox
        }
        Else {
          notice $nick You have no new mail, but if you would like to check your mail options, type !mail
        }
      }
    }
    Else {
      If ($readini(mail.ini,$nick,ignore) != yes) {
        .msg $nick Welcome $nick $+ ! Why not register for the mail service?
        .msg $nick Type !mail register <password>
        .msg $nick You can ignore this message from now on by typing !ignore on
      }
    }
  }
}

on *:TEXT:!ignore*:*: {
  If ($readini(mail.ini,$nick,registered) == yes) {
    .msg $nick You can't ignore us! You're registered!
  }
  Else {
    If ($2 == on) {
      writeini mail.ini $nick ignore yes
      .msg $nick You've been added to the ignore list. If you would like to change this, please type !ignore off
    }
    Else {
      writeini mail.ini $nick ignore no
      .msg $nick You've been removed from the ignore list.
    }
  }
}

on *:PART:#: {
  If ($chan == $mailchan) {
    If ($readini(mail.ini,$nick,registered) == yes) {
      writeini mail.ini $nick logged_in no
    }
  }
}

on *:QUIT: {
  If ($readini(mail.ini,$nick,registered) == yes) {
    writeini mail.ini $nick logged_in no
  }
}

on *:NICK: {
  If ($readini(mail.ini,$nick,registered) == yes) {
    writeini mail.ini $nick logged_in no
  }
  If ($readini(mail.ini,$newnick,registered) == yes) {
    If ($readini(mail.ini,$newnick,ignore) != yes) {
      .msg $nick Welcome back $+ $nick $+ ! To see your messages and options, please login by typing !login <password>
    }
  }
}

on ^*:TEXT:!login*:*: {
  haltdef
  If ($readini(mail.ini,$nick,registered) == yes) {
    If ($2 != $null) {
      If ($readini(mail.ini,$nick,password) == $2) {
        writeini mail.ini $nick logged_in yes
        .msg $nick You have been logged in successfully.
      }
      Else {
        .msg $nick Incorrect password.
      }
    }
    Else {
      .msg $nick Please type !login <password>
    }
  }
  Else {
    .msg $nick Please create an account first. !mail register <password>
  }
  close -m $nick
}

on ^*:TEXT:!delete*:*: {
  haltdef
  If ($readini(mail.ini,$nick,registered) == yes) {
    If ($Readini(mail.ini,$nick,logged_in) == yes) {
      If ($2 != $null) {
        If ($2 == all) {
          mail $nick delete all
        }
        Elseif ($2 isnum) {
          mail $nick delete $2
        }
        Else {
          .msg $nick Unknown command. Please type !mail for more help with this.
        }
      }
      Else {
        .msg $nick Please type !mail for more help with this command.
      }
    }
    Else {
      .msg $nick Please login first. !login <password>
    }
  }
  Else {
    .msg $nick Please create an account first. !mail register <password>
  }
  close -m $nick
}

on ^*:TEXT:!send*:*: {
  haltdef
  If ($readini(mail.ini,$nick,registered) == yes) {
    If ($readini(mail.ini,$nick,logged_in) == yes) {
      If ($3 != $null) {
        If ($readini(mail.ini,$2,registered) == yes) {
          mail $nick send $2 $3-
        }
        Else {
          .msg $nick $2 isn't a registered user!
        }
      }
      Else {
        .msg $nick Please type !send <recipient> <message>
      }
    }
    Else {
      .msg $nick Please login first. !login <password>
    }
  }
  Else {
    .msg $nick Please create an account first. !mail register <password>
  }
  close -m $nick
}

on ^*:TEXT:!inbox*:*: {
  haltdef
  If ($readini(mail.ini,$nick,registered) == yes) {
    If ($readini(mail.ini,$nick,logged_in) == yes) {
      If ($2 == $null) {
        mail $nick inbox all
      }
      Else {
        If ($2 isnum) {
          mail $nick inbox $2
        }
        Else {
          mail $nick inbox all
        }
      }
    }
    Else {
      .msg $nick Please login first. !login <password>
    }
  }
  Else {
    .msg $nick Please register an account first. !mail register <password>
  }
  close -m $nick
}

on ^*:TEXT:!mail*:*: {
  haltdef
  If ($readini(mail.ini,$nick,registered) == yes) {
    If ($readini(mail.ini,$nick,logged_in) == yes) {
      .msg $nick Please select from the following options:
      .msg $nick To view your inbox type !inbox, or to view a specific message, type !inbox <message number>
      .msg $nick To send a message to another use, type !send <user> <message>
      .msg $nick To delete a message, type !delete <message number>, or to delete all your messages, type !delete all
      If ($readini(mail.ini,status,admin) == on) {
        .msg $nick To send a message to the admin, please type !admin <message>
      }
    }
    Else {
      .msg $nick Please login first! Please type !login <password>
    }
  }
  Else {
    If ($2 == $null) {
      .msg $nick You don't have an account with us! Please type !mail register <password>
    }
    Else {
      If ($2 == register) {
        If ($3 == $null) {
          .msg $nick Please type !mail register <password>
        }
        Elseif ($3 == $nick) {
          .msg $nick You can't use your own nick as a password!
        }
        Else {
          mail $nick create $3-
        }
      }
    }
  }
  close -m $nick
}

on ^*:TEXT:!admin*:*: {
  haltdef
  If ($readini(mail.ini,$nick,registered) == yes) {
    If ($readini(mail.ini,$nick,logged_in) == yes) {
      If ($2 == $null) {
        .msg $nick Please type !admin <message>
      }
      Else {
        mail $nick send admin $2-
      }
    }
    Else {
      .msg $nick Please login first! Please type !login <password>
    }
  }
  Else {
    .msg $nick You don't have an account yet! Please type !mail register <password>
  }
  close -m $nick
}

;;;;;;;;;;;;;;;;;
;;;;;Dialogs;;;;;
;;;;;;;;;;;;;;;;;

dialog members {
  title Members List
  option dbu
  size -1 -1 102 95
  list 1, 1 1 100 50
  button "New Member", 2, 1 51 100 10
  button "Delete Member", 3, 1 62 100 10, disable
  button "View Messages", 4, 1 73 100 10, disable
  button "Done", 5, 1 84 100 10, cancel
}

dialog viewmessages {
  title Message List
  option dbu
  size -1 -1 301 184
  text "Member:", 1, 1 1 50 10
  text "", 2, 51 1 249 10, right
  list 3, 1 11 300 150
  button "Delete Selected", 4, 1 162 300 10, disable
  button "Delete All", 5, 1 173 300 10
}

dialog viewadmin {
  title Admin Messages
  option dbu
  size -1 -1 301 184
  list 1, 1 1 300 150
  button "Delete Selected", 2, 1 151 300 10, disable
  button "Delete All", 3, 1 162 300 10
  button "Send a message", 4, 1 173 300 10
}

;;;;;;;;;;;;;;;;;;;;;;;
;;;;;Dialog Events;;;;;
;;;;;;;;;;;;;;;;;;;;;;;

on *:DIALOG:members:*:*: {
  If ($devent == init) {
    var %temp.1 1
    var %temp.2 $readini(mail.ini,status,members)
    While (%temp.1 <= %temp.2) {
      If ($read(mail.txt, %temp.1) != $null) {
        did -a $dname 1 $read(mail.txt, %temp.1)
      }
      inc %temp.1
    }
  }
  If ($devent == sclick) {
    If ($did == 1) {
      did -e $dname 3,4
    }
    If ($did == 2) {
      var %temp.account $$?="Please enter a username."
      var %temp.pass $$?="Please enter a password."
      inbox sudo make %temp.account %temp.pass
      did -a $dname 1 %temp.account
      dialog -v $dname
    }
    If ($did == 3) {
      If ($did(1).seltext == $null) {
        did -b $dname 3,4
      }
      Else {
        inbox sudo remove $did(1).seltext
        dialog -x $dname
        dialog -md $dname $dname
      }
    }
    If ($did == 4) {
      If ($did(1).seltext == $null) {
        did -b $dname 3,4
      }
      Else {
        set %mail.focus $did(1).seltext
        dialog -md viewmessages viewmessages
        dialog -x $dname
      }
    }
  }
  If ($devent == dclick) {
    If ($did == 1) {
      set %mail.focus $did(1).seltext
      dialog -md viewmessages viewmessages
      dialog -x $dname
    }
  }
}

on *:DIALOG:viewmessages:*:*: {
  If ($devent == init) {
    If (%mail.focus == $null) {
      dialog -x $dname
      dialog -md members members
    }
    Else {
      did -a $dname 2 %mail.focus
      var %temp.1 1
      var %temp.2 $readini(mail.ini,%mail.focus,messages)
      While (%temp.1 <= %temp.2) {
        If ($read(%mail.focus $+ mail.txt, %temp.1) != $null) {
          did -a $dname 3 $read(%mail.focus $+ mail.txt, %temp.1)
        }
        inc %temp.1
      }
    }
  }
  If ($devent == sclick) {
    If ($did == 3) {
      did -e $dname 4
      echo -a $did(3).seltext
    }
    If ($did == 4) {
      If ($did(3).seltext == $null) {
        did -b $dname 4
      }
      Else {
        mail %mail.focus delete $did(3).sel
        dialog -x $dname
        dialog -md $dname $dname
      }
    }
    If ($did == 5) {
      mail %mail.focus delete all
      did -r $dname 3
      did -b $dname 4
    }
  }
}

on *:DIALOG:viewadmin:*:*: {
  If ($devent == init) {
    If ($readini(mail.ini,status,admin) == on) {
      var %temp.1 1
      var %temp.2 $readini(mail.ini,admin,messages)
      While (%temp.1 <= %temp.2) {
        If ($read(adminmail.txt, %temp.1) != $null) {
          did -a $dname 1 $read(adminmail.txt, %temp.1)
        }
        inc %temp.1
      }
    }
    Else {
      dialog -x $dname
      echo -a Please type /inbox admin on
    }
  }
  If ($devent == sclick) {
    If ($did == 1) {
      did -e $dname 2
    }
    If ($did == 2) {
      If ($did(1).seltext == $null) {
        did -b $dname 2
      }
      Else {
        mail admin delete $did(1).sel
        dialog -x $dname
        dialog -md $dname $dname
      }
    }
    If ($did == 3) {
      mail admin delete all
      dialog -r $dname 1
      did -b $dname 2
    }
    If ($did == 4) {
      var %temp.1 $$?="Please enter the recipient."
      var %temp.2 $$?="Please enter the messages."
      mail admin send %temp.1 %temp.2
    }
  }
}

;;;;;;;;;;;;;;;;;
;;;;;Pop-ups;;;;;
;;;;;;;;;;;;;;;;;

menu nicklist,query {
  -
  Mail
  .Register User: /inbox sudo make $$1 12345
  .Unregister User: /inbox sudo remove $$1
  .View Messages: /set %mail.focus $$1 | /dialog -md viewmessages viewmessages
}

menu * {
  -
  Mail
  .View Admin Messages: /dialog -md viewadmin viewadmin
  .View Members: /inbox members
}

;;;;;;;;;;;;;;;;
;;;;;Safety;;;;;
;;;;;;;;;;;;;;;;

on $*:TEXT:/^[\.!@](.*) [$%](.*)/Si:*:{ halt }

Comments

Sign in to comment.
Tamaki   -  Dec 09, 2009

Finished the update, if you require any support on it, come to my server irc.authoritygamer.com

 Respond  
mskatlee   -  Dec 09, 2009

I like it .. but I'm getting this error :

  • /if: '!+' unknown operator (line 102, script1.txt)
    and:
  • /writeini: insufficient parameters (line 162, script1.txt)

also getting an error stating psw is incorrect

 Respond  
Tamaki   -  Nov 20, 2009

good point, but i like it better this way anyway

 Respond  
Ghost-writer   -  Nov 20, 2009

no need for inis, you can use $lines to see if there are that many lines in the text file :)

 Respond  
Tamaki   -  Nov 20, 2009

yeah, i went over and i've made plenty of changes, however i'm not going to release them on this site, as i want to see how many people are actually going to use this, PM me and i'll tell you where you can get the info

 Respond  
jaystew   -  Oct 11, 2009

hey

just wondering if u have managed to go over the script yet?

 Respond  
Tamaki   -  Oct 06, 2009

i don't remember making it that way, but i will look over it to see about it

 Respond  
jaystew   -  Oct 06, 2009

cool, i look forward tot he update - also it maybe a good idea when sending mail. you have to spell the name with case sensitve, eg if nick is MyNiCk you cant do it !send mynick. maybe a good idea to allow it so it can be done with out case sensitve as most servers have services such as nickserv and will no allow one nick with mynic and another with MyNiCk also makes easier for th eperson sending the message to rememebr how the name is spelt lol

 Respond  
Tamaki   -  Oct 05, 2009

i did that even when you did have mail, but i think i'll make it to where it'll say you don't have any messages or something like that when you don't have any mail...check back tomorrow. come to my server if you're interested in getting my staff bot, or working on some stuff together. it's irc.authoritygamer.com

 Respond  
jaystew   -  Oct 05, 2009

cool works great, noticed with the !inbox for it to check all your mails it says checking mail now i will elt you know when im done and then it doesnt do nothing else. brilliant script though like it alot

 Respond  
Tamaki   -  Sep 27, 2009

-edit-

In the update, I fixed the manual account creation. Users can now register their own accounts via PM.

 Respond  
jaystew   -  Sep 27, 2009

all works great for me apart from making accounts they have to be force made. i type !mail register password and it just keeps sayign u have no account register one

 Respond  
Tamaki   -  Jul 09, 2009

-edit-

In the new version of the script, I took out that annoying, every channel advert thingy. So now it's safe to use accross all servers, b/c it only works on the channel you specify.

Another thing, I've made a whole bunch of commands activate as local commands, why? Because I realized local commands will process faster than activated scripts.

If you have any other features you'd like for me to add, simply come to my server and have a chat with me.

/server -m irc.authoritygamer.com -j #authoritygamer

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.