Jump to content




MMTP - A REAL mailing system

api networking

14 replies to this topic

#1 RoD

  • Members
  • 313 posts

Posted 10 March 2015 - 08:55 PM

MMTP

Minecraft Mail Transfer Protocol



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[/size][/font]
[font=arial,helvetica,sans-serif][size=3]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.

Edited by RoD, 10 March 2015 - 08:57 PM.


#2 InDieTasten

  • Members
  • 357 posts
  • LocationGermany

Posted 10 March 2015 - 09:11 PM

The problem a lot of people will see is the dependency on your server. If you decide to take it down, it won't work, all emails are gone and no-one could replace besides you, because the program only works with your architecture, and you haven't released any back-end code ;)

Otherwise, this is a pretty nifty thing, in case it actually works^^

Oh, and welcome to GitHub Community <3

#3 RoD

  • Members
  • 313 posts

Posted 10 March 2015 - 09:12 PM

View PostInDieTasten, on 10 March 2015 - 09:10 PM, said:

The problem a lot of people will see is the dependency on your server. If you decide to take it down, it won't work, all emails are gone and no-one could replace besides you, because the program only works with your architecture, and you haven't released any back-end code ;)

Sorry for my ignorance, but back-end program is like the PHP code and that stuff?

View PostInDieTasten, on 10 March 2015 - 09:10 PM, said:

Otherwise, this is a pretty nifty thing, in case it actually works^^

Go ahead and test it ;) Report any bugs and suggestions, please :D

#4 InDieTasten

  • Members
  • 357 posts
  • LocationGermany

Posted 10 March 2015 - 09:17 PM

View PostRoD, on 10 March 2015 - 09:12 PM, said:

Sorry for my ignorance, but back-end program is like the PHP code and that stuff?
Yeah, well... besides MySQL login credentials for example(you could X those out).
Providing the PHP script(s) would definitely improve transparency and enables us to suggest fixes to backend-liable bugs and security problems, which you are facing a lot when this comes to get used a lot. I imagine spam emails and injection attacks against your infrastructure and database.

#5 RoD

  • Members
  • 313 posts

Posted 10 March 2015 - 09:28 PM

View PostInDieTasten, on 10 March 2015 - 09:17 PM, said:

View PostRoD, on 10 March 2015 - 09:12 PM, said:

Sorry for my ignorance, but back-end program is like the PHP code and that stuff?
Yeah, well... besides MySQL login credentials for example(you could X those out).
Providing the PHP script(s) would definitely improve transparency and enables us to suggest fixes to backend-liable bugs and security problems, which you are facing a lot when this comes to get used a lot. I imagine spam emails and injection attacks against your infrastructure and database.
Ok, i just placed the two PHP files that i use in this system. Thanks for pointing it out :P

#6 InDieTasten

  • Members
  • 357 posts
  • LocationGermany

Posted 10 March 2015 - 09:35 PM

View PostRoD, on 10 March 2015 - 09:28 PM, said:

Yeah, well... besides MySQL login credentials for example(you could X those out).
I highly recommend you to put your credentials in an extra php file, that only contains sql credentials and require it(and then not upload it). You should change the password now, since it's in public and everyone could easily connect to the database and ruin everything ;)

#7 RoD

  • Members
  • 313 posts

Posted 10 March 2015 - 09:54 PM

View PostInDieTasten, on 10 March 2015 - 09:35 PM, said:

View PostRoD, on 10 March 2015 - 09:28 PM, said:

Yeah, well... besides MySQL login credentials for example(you could X those out).
I highly recommend you to put your credentials in an extra php file, that only contains sql credentials and require it(and then not upload it). You should change the password now, since it's in public and everyone could easily connect to the database and ruin everything ;)
Holly **** i am so dumb lol... Thank you so much for pointing that out... Question: after i delete a file on GitHub, does it stays anywhere on the repository history?

#8 InDieTasten

  • Members
  • 357 posts
  • LocationGermany

Posted 10 March 2015 - 10:01 PM

View PostRoD, on 10 March 2015 - 09:54 PM, said:

View PostInDieTasten, on 10 March 2015 - 09:35 PM, said:

View PostRoD, on 10 March 2015 - 09:28 PM, said:

Yeah, well... besides MySQL login credentials for example(you could X those out).
I highly recommend you to put your credentials in an extra php file, that only contains sql credentials and require it(and then not upload it). You should change the password now, since it's in public and everyone could easily connect to the database and ruin everything ;)
Holly **** i am so dumb lol... Thank you so much for pointing that out... Question: after i delete a file on GitHub, does it stays anywhere on the repository history?
There are ways to remove files permanently. The GitHub help pages have a tutorial on deleting sensitive data once commited to a repo. It's not too bad, but as long as your password isn't used elsewhere and you've changed it by now, you don't need to worry too much. You can remove it from the repos history, but your gain in security isn't that much, since you could say what once was public, will always be public. Just change the password, and relocated the variable initialization in a different file secret from the world as I've said earlier, and you should be fairly good to go :)

#9 InDieTasten

  • Members
  • 357 posts
  • LocationGermany

Posted 10 March 2015 - 10:08 PM

Heres the page. Always good to know

#10 RoD

  • Members
  • 313 posts

Posted 10 March 2015 - 10:31 PM

View PostInDieTasten, on 10 March 2015 - 10:08 PM, said:

Heres the page. Always good to know
Thank you so much! :D

#11 RoD

  • Members
  • 313 posts

Posted 11 March 2015 - 11:07 PM

UPDATE: The GitHub repo has been renovated, and there is now a folder wiht the PHP files. Please report any bugs you find :) Thank you again, @InDieTasten

#12 RoD

  • Members
  • 313 posts

Posted 11 March 2015 - 11:53 PM

OK, i think that i finally managed to release a stable version of the client. Please give me a discount at GitHub.. Sometimes it gets confusing X)

#13 InDieTasten

  • Members
  • 357 posts
  • LocationGermany

Posted 12 March 2015 - 12:01 AM

I would suggest you to handle data in your api differently. I don't get, why you would append the message"id" to every field name of the message?
(And git(hub) is actually confusion for like... everyone in the beginning. You just need to get used to it and experiment with all the different features)

#14 RoD

  • Members
  • 313 posts

Posted 12 March 2015 - 07:52 PM

View PostInDieTasten, on 12 March 2015 - 12:01 AM, said:

I would suggest you to handle data in your api differently. I don't get, why you would append the message"id" to every field name of the message?
(And git(hub) is actually confusion for like... everyone in the beginning. You just need to get used to it and experiment with all the different features)

You mean like "from_1"? well i guess i could drop them in individual tables but... that would be hard..

#15 DannySMc

  • Members
  • 1,808 posts
  • Location/home/dannysmc95

Posted 13 March 2015 - 04:12 PM

This is awesome! Nice work!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users