379 posts
Location
Hawaii
Posted 11 March 2013 - 06:52 PM
Hey guys,
I've been working on a rednet based email system called SmartMail. I got some of the client GUI down, but I wanted to work on the sending/receiving of the messages. I wasn't sure if I should encrypt the messages somehow so that there's a little bit of security, or just leave it in plain text. And, if I should encrypt it, how should I do it?
Thanks in advance!
1619 posts
Posted 11 March 2013 - 06:55 PM
379 posts
Location
Hawaii
Posted 11 March 2013 - 07:44 PM
There are a few encryption APIs out there. Here's one:
http://www.computerc...__fromsearch__1
Thanks, looks like I'll be using it. And one more thing. I would like a few suggestions on how to improve this GUI; the sidebar looks odd.
Image:
http://imgur.com/PRhwXYe
2088 posts
Location
South Africa
Posted 12 March 2013 - 01:56 AM
Wow looks quite nice :P/>
Suggestions … hmm.. sidebar… Maybe the colours?
You know what would look really awesome… a sliding side bar with the options :D/>
I'll make a sample code to show what I mean.
EDIT:
Run
this code and check it out :P/>
The Background is in the form of a table, but if you want it, it's
here - Just having grey/lightgrey/black is boring ^^
Blue background and white text colour looks nice :P/>
379 posts
Location
Hawaii
Posted 12 March 2013 - 04:56 PM
Wow looks quite nice :P/>
Suggestions … hmm.. sidebar… Maybe the colours?
You know what would look really awesome… a sliding side bar with the options :D/>
I'll make a sample code to show what I mean.
EDIT:
Run
this code and check it out :P/>
The Background is in the form of a table, but if you want it, it's
here - Just having grey/lightgrey/black is boring ^^
Blue background and white text colour looks nice :P/>
At first, I thought you meant a vertical scrolling sidebar, which I wouldn't need yet, but now I see what you mean, horizontally expanding it and such. I think its a great idea! :D/> It allows for a larger message description area. I think I'll be implementing something of the sort. Thanks!
Yea, I noticed a lack in colors, so I had first made only the selected sidebar item light blue, but it just didn't cut it. The blue does look nice, but perhaps not in the sidebar. Maybe…white…or…light blue…Ill test stuff out. :P/>
Oh, and the difference between the Computer ID and the User ID is for player identification. I could set my User ID to "Smiley", and any messages received from me would display "Smiley" in the From column. If no User ID is set, it defaults to the Computer ID.
Edit: I'm marveling at how short your code to draw the sidebar is :o/>
Edit 2: Then again, mine fits itself to the screen (even though terminal screens don't resize :P/>)
2088 posts
Location
South Africa
Posted 12 March 2013 - 05:43 PM
Vertical sliding bar? Wouldn't make sense for a sidebar! :lol:/> The main reason why I suggested it was because it gives more space for the email area and it looks cool :P/>
Yeah I chose random colours, the sidebar with cyan is meh so yeah you must change that :P/>
I see!
Haha the transition function isn't long - the write functions take up most of the space
379 posts
Location
Hawaii
Posted 15 March 2013 - 06:55 PM
I think I found a good color scheme. And a nice way to list messages. But I still have to implement the moving sidebar.
Image:
http://imgur.com/Die79tY
2088 posts
Location
South Africa
Posted 15 March 2013 - 09:16 PM
The way I made it is that if the sliding bar is out, you will be unable to click any message and only the sliding bar area is clickable.
The sliding bar gets written over the text part but you can do what suits you :P/>
379 posts
Location
Hawaii
Posted 15 March 2013 - 10:34 PM
Can anyone think of a better method for storing the contents of the terminal window without using tables and coordinates as keys? I feel like there's a much simpler method that I'm missing. I need this for redrawing the message window when the sidebar retracts.
Edit: I'll check out some windowing code
Edit2: I just looked back at my old picture of the screen, it looks like someone put it on a black and white TV :P/>
Edit3: Perhaps I'll just draw the messages first, then the sidebar over it.
2088 posts
Location
South Africa
Posted 16 March 2013 - 03:11 AM
Why? What's wrong with tables? They are extremely useful :P/>
379 posts
Location
Hawaii
Posted 16 March 2013 - 07:57 AM
Wouldn't the lookup for each coordinate key in a table be time consuming?
Example:
http://pastebin.com/8QqrXeXC
2088 posts
Location
South Africa
Posted 16 March 2013 - 08:29 AM
Oh do you want the text under the 'Subject' header to be redrawn as the bar retracts? Honestly to me, it's a waste of time and code - although it will make it look cool :P/>
What you could do is make a function to over write/print that adds to a table of the position printed like
local screenTable = {}
local sX, sY = term.getSize()
for x = 1, sX do
for y = 1, sY do
screenTable[x][y] = ' '
end
end
-- and then make a write function that each write/print will add the correct letter to the correct
-- index for the table that contains all text on the screen at each co-ordinate
-- and then when you want to redraw
write( screenTable[x][y] ) -- etc
379 posts
Location
Hawaii
Posted 16 March 2013 - 08:52 AM
Yea, like that. Otherwise I'd have to draw it after it retracts, but it might look weird if I don't draw it as it retracts. And yes, it would look cool. :D/>
2088 posts
Location
South Africa
Posted 16 March 2013 - 09:36 AM
Yea, like that. Otherwise I'd have to draw it after it retracts, but it might look weird if I don't draw it as it retracts. And yes, it would look cool. :D/>
Well, it only moves about 6 x values to the left, so it will be fast… But if you have the time for it, go ahead :P/>
379 posts
Location
Hawaii
Posted 17 March 2013 - 10:01 PM
Almost done, I think it looks pretty cool. And I just realized (just now) that you can send a message to a specific computer in rednet, so encryption probably isn't needed. :P/>
799 posts
Location
Land of Meh
Posted 17 March 2013 - 10:13 PM
Almost done, I think it looks pretty cool. And I just realized (just now) that you can send a message to a specific computer in rednet, so encryption probably isn't needed. :P/>
The message isn't actually sent privately, people can still intercept it. Using the new modem channels in 1.5, the computer just uses its ID as a channel number. People can actually fake IDs, and intercept messages by just listening on a certain channel. Encryption is probably a good idea.
Here's a tutorial on the new modems and what they do/how they work.
379 posts
Location
Hawaii
Posted 17 March 2013 - 10:27 PM
Ah, thanks. Clarification: Before 1.5, was it the case that it was private?
799 posts
Location
Land of Meh
Posted 18 March 2013 - 12:33 AM
Ah, thanks. Clarification: Before 1.5, was it the case that it was private?
Yes. Before 1.5, rednet.send was private, and rednet.broadcast sent to everyone.
379 posts
Location
Hawaii
Posted 18 March 2013 - 01:31 AM
Darn :unsure:/>
Encrypting it is.