Summary:
Basically MMTP is a way to send mails ( m-mails (?) ) between your friends. And no this is not just on your server, this does not use rednet. This uses PHP, HTTP, and MySQL to send mails to every registed user on the system you want to contact. This is useful when you want to comunicate with a friend who is in another server, or in single player. The system is fast and safe (password encryption is on, but please do not user any real-life password, just in case). The client is clean and fast. But please, feel free to create your own client using the 'server' API.
Installing:
All downloads are at the end of this post.
The installer requires the following syntax:
installer [mode] <silent>
Installing modes:
full (Includes the client + GUI API + server API)
api (Includes server API)
If the silent argument is "true" it will display no text during the download.
Included files:
Client - The MMTP client
GUI - If you downloaded using full mode, you will have this API along with the client program.
Server - The API that interacts with the server and preforms all the operations.
API Documentation:
The API is really simple and easy to use. It just interacts with the server and sends your account details to check your identity. The password is encrypted using a encryption API, also included in the program. Here are the functions:
login( username , password )
create( username , password )
check() --No need to provide username or password, as the API will save your username and password as soon as the login is sucessfull. This function will return all the mails as a table (to use this table read the MMTP Tables at the end)
seen( message_content , date ) --NOTE: id and date are the same. This will compare and see if theres any message with these parameters and mark it as seen.
get() --Gets all the unseen messages.
send( to , title , content ) --Sends a message to the given user
MMTP tables:
The tables are the tricky part. I had to manage a way to download all the messages, yet in a organised way so we could display and interact with the m-mails.
This is an example of a table:
{ msg=1 , from_1="jack" , to_1="me" , title_1="Hey" , content_1="hello world" , seen_1="1" , id_1 "2015-03-09 17:25:55" }
To get a value from the table you need to specify the message number like:
message_one_title = table["title_1"] -- This will return the title of the message 1
message_one_from = table["from_"..tostring(2)] –you can also convert numbers to strings to specify the message number.
msg
This variable has the number of messages for the user. Usefull to interact with other fields. For example: title = table["title_"..table.msg]
from_
NOTE: From now on all the table values will have a number, like: from_2 (This will return the sender of the message #2) As i said above from_ has the message sender.
to_
The user that the message was sent to.
title_
This variable has the message title.
content_
The message content comes here.
seen_
This will return a 0 or 1, being 0 = not seen, and 1 = seen
id_
Sorry if this confuses you. "id? but this is the date…" i know, i know. I just added a value to the database called id, so i could organize the messages on the client, but the best way to organize the mails was by date, so…
Download:
To download the installer simply type:
> pastebin get gLuggWkq installer
Then:
> installer full
OR
> installer api
Contribute on GitHub:
I would love to have feedback and contributions in this project.
The MMTP page on GitHub.