Commit 0839560b authored by Danny SMc's avatar Danny SMc

Amends to most files

parent 8cad4fec
ewogIENvbmZpZyA9IHsKICAgIFVzZUJldGFVcGRhdGVTdHJlYW0gPSBmYWxzZSwKICAgIFBsdWdpbnNEaXJlY3RvcnkgPSAiL0RBX1BsdWdpbnMiLAogICAgRW5hYmxlUGx1Z2lucyA9IHRydWUsCiAgICBFeGFtcGxlU2V0dGluZyA9IHRydWUsCiAgICBDb25maWdGaWxlUGF0aCA9ICIuRGlzY292ZXJDb25maWciLAogICAgQmxvY2tUZXJtaW5hdGUgPSBmYWxzZSwKICAgIFBsdWdpbkNvbmZpZ0ZpbGUgPSAiLkRpc2NvdmVyQXBwUGx1Z2lucyIsCiAgICBBdXRvVXBkYXRlID0gZmFsc2UsCiAgfSwKICBBY2NvdW50ID0gewogICAgUGFzc3dvcmQgPSAiYWQ0ZmFhMjU2MzY3Y2EzZTc5ZGZiNDAwMGQyMWQ3ZTI4MzQwMGJiZjI4Y2YzMjhhNzA1MWRiYmZhNDU4YjdkOCIsCiAgICBVc2VybmFtZSA9ICJkYW5ueXNtYzk1IiwKICB9LAp9
\ No newline at end of file
ewogIENvbmZpZyA9IHsKICAgIEF1dG9VcGRhdGUgPSB0cnVlLAogICAgUGx1Z2luc0RpcmVjdG9yeSA9ICJEQV9QbHVnaW5zIiwKICAgIEVuYWJsZVBsdWdpbnMgPSB0cnVlLAogICAgVXNlQmV0YVVwZGF0ZVN0cmVhbSA9IGZhbHNlLAogICAgQ29uZmlnRmlsZVBhdGggPSAiLkRpc2NvdmVyQ29uZmlnIiwKICAgIEJsb2NrVGVybWluYXRlID0gZmFsc2UsCiAgICBFeGFtcGxlU2V0dGluZyA9IHRydWUsCiAgICBQbHVnaW5Db25maWdGaWxlID0gIi5EaXNjb3ZlckFwcFBsdWdpbnMiLAogIH0sCiAgQWNjb3VudCA9IHsKICAgIFBhc3N3b3JkID0gImFkNGZhYTI1NjM2N2NhM2U3OWRmYjQwMDBkMjFkN2UyODM0MDBiYmYyOGNmMzI4YTcwNTFkYmJmYTQ1OGI3ZDgiLAogICAgVXNlcm5hbWUgPSAiZGFubnlzbWM5NSIsCiAgfSwKfQ==
\ No newline at end of file
Finder
-> Add click support
-> Fix group chat
Help FAQ
-> Document everything
Notes
-> Create main application
Chat Rooms
-> Add the screens into this
DAPI
-> Add FAQ/Help Insertions
-> Add Credits Insertions
FileManager
-> Create main screen for this
PHP-API:
-> Check user account failure and callbacks
\ No newline at end of file
Chat Rooms
-> Add the screens into this
\ No newline at end of file
......@@ -55,7 +55,8 @@ function program.account.register()
elseif (args[3] >= 43 and args[3] <= 50) and (args[4] == 19) then
if username and password and email then
base.draw.textc("Requesting Authentication, Please Wait", 17, false, "lightGrey", "white")
if Discover.User:Register(username, password, email) then
local regok, errmsg = Discover.User:Register(username, password, email)
if regok then
base.gui.alert("Registered. Obtaining authkey, please wait")
sleep(0.5)
local status = Discover.User:Login(username, password)
......@@ -72,7 +73,7 @@ function program.account.register()
end
else
base.draw.box(1, 51, 17, 1, " ", "white", "white")
base.draw.textc(tostring(discover.data.errormsg), 17, false, "lightGrey", "white")
base.draw.textc(tostring(errmsg), 17, false, "lightGrey", "white")
sleep(1)
base.thread.remove("Account")
base.thread.switch("Home")
......
......@@ -47,7 +47,6 @@ local paths = {
"cloud/cloud.main.lua";
"mail/mail.main.lua";
"chat/chat.main.lua";
"chat/chat.personal.lua";
"chat/chat.group.lua";
"chat/chat.global.lua";
"chat/chat.info.lua";
......
......@@ -7,49 +7,114 @@ function program.chat.global()
base.screen.colour("white")
program.draw.menubar("Chat: Global")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.textr("Exit ", 19, false, "red", "grey")
local messages = {}; local scroll = 0; local counter = 0;
base.draw.textr("Back ", 19, false, "red", "grey")
base.draw.textl(" About", 19, false, "lightBlue", "grey")
base.draw.textc("Anchor", 19, false, "orange", "grey")
base.draw.box(1, 51, 18, 1, " ", "lightGrey", "lightGrey")
base.draw.textc("Click to chat", 18, false, "white", "lightGrey")
local messages = {}; local renderdata = {}; local scroll = 0; local counter = 0; local anchor = true;
base.draw.textc("Joining chat, please wait...", 10, false, "red", "white")
local ok, err = Discover.Chat:Send("global", "*" .. tostring(Discover.User.Data.Username) .. " has joined the conversation.")
if not ok then
base.gui.alert("Error: " .. tostring(err))
sleep(1.5)
program.chat.main();
end
local function render()
if #messages == 0 then
base.draw.textc("No messages to show!", 10, false, "red", "white")
else
base.draw.box(1, 51, 10, 1, " ", "white", "white")
for i=1, 14 do
if #messages >= i+scroll then
if anchor then
scroll = #renderdata - 13;
if scroll < 0 then
scroll = 0
end
end
for i=1, 13 do
base.draw.box(1, 51, i+3, 1, " ", "white", "white")
if #renderdata >= i+scroll then
if renderdata[i+scroll]:sub(1,3) == "[A]" then
base.draw.texta(renderdata[i+scroll]:sub(4), 3, i+3, false, "lightGrey", "white")
elseif renderdata[i+scroll]:sub(1,3) == "[M]" then
base.draw.texta(renderdata[i+scroll]:sub(4), 4, i+3, false, "cyan", "white")
elseif renderdata[i+scroll]:sub(1,3) == "[T]" then
-- Do nothing
elseif renderdata[i+scroll]:sub(1,3) == "[S]" then
-- Do nothing
end
end
end
end
local function parse()
renderdata = {};
for i = #messages, 1, -1 do
table.insert(renderdata, "[A]" ..tostring(messages[i].sender) .. " - " .. tostring(messages[i].sent_time));
for _,b in ipairs(base.data.wordwrap(messages[i].message, 45)) do
table.insert(renderdata, "[M]" .. tostring(b));
end
--table.insert(renderdata, "[T]" .. tostring(v.sent_time));
table.insert(renderdata, "[S]");
end
end
render();
-- Initialise First Call
Discover.Chat:View("global", _, true);
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Chat: Global")
if counter >= 10 then
Discover.Chat:List("global")
local counter = 0;
Discover.Chat:View("global", _, true);
counter = 0;
else
counter = counter + 1;
end
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Global", args[3], args[4])
elseif (args[3] >= 2 and args[3] <= 6) and args[4] == 19 then
program.chat.info("usage");
elseif (args[3] >= 21 and args[3] <= 30) and args[4] == 19 then
anchor = true;
render();
elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then
base.thread.remove("Profile")
base.thread.switch("Home")
program.chat.main();
elseif (args[3] >= 1 and args[3] <= 51) and args[4] == 18 then
base.draw.box(1, 51, 18, 1, " ", "lightGrey", "lightGrey")
base.colour.set("white", "lightGrey")
term.setCursorPos(1, 18)
write(": ")
local newmessage = base.io.limitRead(45)
local ok, err = Discover.Chat:Send("global", newmessage)
if not ok then
base.gui.alert("Error: " .. tostring(err))
sleep(1)
program.chat.main();
end
base.draw.box(1, 51, 18, 1, " ", "lightGrey", "lightGrey")
Discover.Chat:View("global", _, true);
program.draw.menubar("Chat: Global")
end
elseif args[1] == "http_failure" then
Discover.Chat:List("global")
-- Error occurred
elseif args[1] == "http_success" then
local ok, data = Discover.Chat:Handle(args[3].readAll());
messages = data;
parse(); render();
elseif args[1] == "mouse_scroll" then
if args[2] == -1 then
if scroll > 0 then
scroll = scroll - 1
anchor = false;
render();
end
elseif args[2] == 1 then
if scroll+13 < #renderdata then
scroll = scroll + 1
anchor = false;
render();
end
end
end
end
end
\ No newline at end of file
......@@ -3,42 +3,117 @@
Desc: Main chat group viewer
--]]
function program.chat.group(screen)
if screen == "list" then
base.screen.colour("white")
program.draw.menubar("Chat: Group")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.textr("Exit ", 19, false, "red", "grey")
function program.chat.group(gid)
base.screen.colour("white")
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Chat: Group")
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Group", args[3], args[4])
elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then
base.thread.remove("Profile")
base.thread.switch("Home")
program.draw.menubar("Chat: Group")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.textr("Back ", 19, false, "red", "grey")
base.draw.textl(" About", 19, false, "lightBlue", "grey")
base.draw.textc("Anchor", 19, false, "orange", "grey")
base.draw.box(1, 51, 18, 1, " ", "lightGrey", "lightGrey")
base.draw.textc("Click to chat", 18, false, "white", "lightGrey")
local messages = {}; local renderdata = {}; local scroll = 0; local counter = 0; local anchor = true;
base.draw.textc("Joining chat, please wait...", 10, false, "red", "white")
local ok, err = Discover.Chat:Send("group", tostring(gid), "*" .. tostring(Discover.User.Data.Username) .. " has joined the conversation.")
if not ok then
base.gui.alert("Error: " .. tostring(err))
sleep(1.5)
program.chat.main();
else
base.draw.box(1, 51, 10, 1, " ", "white", "white")
end
local function render()
if anchor then
scroll = #renderdata - 13;
if scroll < 0 then
scroll = 0
end
end
for i=1, 13 do
base.draw.box(1, 51, i+3, 1, " ", "white", "white")
if #renderdata >= i+scroll then
if renderdata[i+scroll]:sub(1,3) == "[A]" then
base.draw.texta(renderdata[i+scroll]:sub(4), 3, i+3, false, "lightGrey", "white")
elseif renderdata[i+scroll]:sub(1,3) == "[M]" then
base.draw.texta(renderdata[i+scroll]:sub(4), 4, i+3, false, "cyan", "white")
elseif renderdata[i+scroll]:sub(1,3) == "[T]" then
-- Do nothing
elseif renderdata[i+scroll]:sub(1,3) == "[S]" then
-- Do nothing
end
end
end
elseif screen == "view" then
base.screen.colour("white")
program.draw.menubar("Chat: Group::View")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.textr("Exit ", 19, false, "red", "grey")
end
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Chat: Group::View")
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Group::View", args[3], args[4])
elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then
base.thread.remove("Profile")
base.thread.switch("Home")
local function parse()
renderdata = {};
for i = #messages, 1, -1 do
table.insert(renderdata, "[A]" ..tostring(messages[i].sender) .. " - " .. tostring(messages[i].sent_time));
for _,b in ipairs(base.data.wordwrap(messages[i].message, 45)) do
table.insert(renderdata, "[M]" .. tostring(b));
end
table.insert(renderdata, "[S]");
end
end
-- Initialise First Call
Discover.Chat:View("group", tostring(gid), true);
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Chat: Group")
if counter >= 10 then
Discover.Chat:View("group", tostring(gid), true);
counter = 0;
else
counter = counter + 1;
end
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Group", args[3], args[4])
elseif (args[3] >= 2 and args[3] <= 6) and args[4] == 19 then
program.chat.info("usage");
elseif (args[3] >= 21 and args[3] <= 30) and args[4] == 19 then
anchor = true;
render();
elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then
program.chat.main();
elseif (args[3] >= 1 and args[3] <= 51) and args[4] == 18 then
base.draw.box(1, 51, 18, 1, " ", "lightGrey", "lightGrey")
base.colour.set("white", "lightGrey")
term.setCursorPos(1, 18)
write(": ")
local newmessage = base.io.limitRead(45)
local ok, err = Discover.Chat:Send("group", tostring(gid), newmessage)
if not ok then
base.gui.alert("Error: " .. tostring(err))
sleep(1)
program.chat.main();
end
base.draw.box(1, 51, 18, 1, " ", "lightGrey", "lightGrey")
Discover.Chat:View("group", tostring(gid), true);
end
elseif args[1] == "http_failure" then
-- Error occurred
elseif args[1] == "http_success" then
local ok, data = Discover.Chat:Handle(args[3].readAll());
messages = data;
parse(); render();
elseif args[1] == "mouse_scroll" then
if args[2] == -1 then
if scroll > 0 then
scroll = scroll - 1
anchor = false;
render();
end
elseif args[2] == 1 then
if scroll+13 < #renderdata then
scroll = scroll + 1
anchor = false;
render();
end
end
end
......
......@@ -3,44 +3,88 @@
Desc: Main chat information menu
--]]
function program.chat.info()
base.screen.colour("white")
program.draw.menubar("Chat: Info")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.textr("Back ", 19, false, "red", "grey")
function program.chat.info(screen)
if screen == "usage" then
base.screen.colour("white")
program.draw.menubar("Chat: Info")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.textr("Back ", 19, false, "red", "grey")
local text = "The chat rooms are a beta feature to the DiscoverApp, that in essence will allow you to live chat to other users. You can participate in the global chat, a group chat that you can make or join, and public user to user messages. Please note that group chat is a public feature, which means groups will be listed when wanting to join one, this is only for while it is in beta, then private chats will be enabled. The chat is for users wishing to send messages to other members as well as join in with live chat! The chat supports timestamps also, to show when a message was sent, please understand that this is based of the server location which is GMT+1. Any ideas you wish to see, just send me a message on the CCForums, I am \'DannySMc\' or send me a ticket on the DiscoverApp. If you wish to work on the development of the Discover App, just send me a message also and I can look at adding you onto the git repository.";
local scroll = 0; local content = base.data.wordwrap(text, 49)
local function render()
for i=1, 14 do
if scroll+i <= #content then
base.draw.box(1, 51, i+3, 1, " ", "white", "white")
base.draw.textl(" " .. tostring(content[i+scroll]), i+3, false, "cyan", "white")
local text = "Using the chat room is simple, to view the messages load the chat you wish to use, and the messages will appear, give it a second, it will also announce your join event. Then it will load. Messages are rendered in a simple to use way, but they are anchored by default to the floor, so the newest messages appear at the bottom. To scroll, this will disable the anchor, to re-enable it, just click anchor text at the bottom centre. To talk in chat, click the message box just before the bottom row, and then you will be able to chat, type your message and press enter, and this will send the data over then update your screen to keep up.";
local scroll = 0; local content = base.data.wordwrap(text, 49)
local function render()
for i=1, 14 do
if scroll+i <= #content then
base.draw.box(1, 51, i+3, 1, " ", "white", "white")
base.draw.textl(" " .. tostring(content[i+scroll]), i+3, false, "cyan", "white")
end
end
end
end
render();
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Chat: Info")
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Info", args[3], args[4])
elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then
program.chat.main()
render();
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Chat: Info")
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Info", args[3], args[4])
elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then
program.chat.main()
end
elseif args[1] == "mouse_scroll" then
if args[2] == -1 then
if scroll > 0 then
scroll = scroll - 1
render();
end
elseif args[2] == 1 then
if #content > 14+scroll then
scroll = scroll + 1
render();
end
end
end
end
else
base.screen.colour("white")
program.draw.menubar("Chat: Info")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.textr("Back ", 19, false, "red", "grey")
local text = "The chat rooms are a beta feature to the DiscoverApp, that in essence will allow you to live chat to other users. You can participate in the global chat, a group chat that you can make or join, and public user to user messages. Please note that group chat is a public feature, which means groups will be listed when wanting to join one, this is only for while it is in beta, then private chats will be enabled. The chat is for users wishing to send messages to other members as well as join in with live chat! The chat supports timestamps also, to show when a message was sent, please understand that this is based of the server location which is GMT+1. Any ideas you wish to see, just send me a message on the CCForums, I am \'DannySMc\' or send me a ticket on the DiscoverApp. If you wish to work on the development of the Discover App, just send me a message also and I can look at adding you onto the git repository.";
local scroll = 0; local content = base.data.wordwrap(text, 49)
local function render()
for i=1, 14 do
if scroll+i <= #content then
base.draw.box(1, 51, i+3, 1, " ", "white", "white")
base.draw.textl(" " .. tostring(content[i+scroll]), i+3, false, "cyan", "white")
end
end
elseif args[1] == "mouse_scroll" then
if args[2] == -1 then
if scroll > 0 then
scroll = scroll - 1
render();
end
render();
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Chat: Info")
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Info", args[3], args[4])
elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then
program.chat.main()
end
elseif args[2] == 1 then
if #content > 14+scroll then
scroll = scroll + 1
render();
elseif args[1] == "mouse_scroll" then
if args[2] == -1 then
if scroll > 0 then
scroll = scroll - 1
render();
end
elseif args[2] == 1 then
if #content > 14+scroll then
scroll = scroll + 1
render();
end
end
end
end
......
......@@ -10,8 +10,31 @@ function program.chat.main()
base.draw.textr("Exit ", 19, false, "red", "grey")
base.draw.textl(" About", 19, false, "orange", "grey")
local scroll = 0;
base.draw.textc("Downloading groups list ... ", 10, false, "red", "white")
local ok, group_list = Discover.Chat:List("group");
local function render()
for i=1, 14 do
if i+scroll <= #group_list then
base.draw.box(1, 51, i+3, 1, " ", "white", "white")
base.draw.texta(" " .. tostring(i+scroll).. ": " .. tostring(group_list[i+scroll]), 24, i+3, false, "cyan", "white")
end
end
end
if not ok then
base.draw.box(24, 27, 10, 1, " ", "white", "white")
base.draw.texta("Could not download groups", 27, 10, false, "red", "white")
downloaded_groups = false;
else
base.draw.box(1, 51, 10, 1, " ", "white", "white")
downloaded_groups = true;
render();
end
local count = 0;
local options = {"Global Chat", "Group Chat", "Personal Message"};
local options = {"Global Chat", "Group Chat"};
for i=1, 22 do base.draw.box(i, 1, 3, 16, false, "lightGrey", "lightGrey"); end
for i=1, (#options*2), 2 do
count = count + 1;
......@@ -34,9 +57,53 @@ function program.chat.main()
elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 4 then
program.chat.global()
elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 6 then
program.chat.group("list")
elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 8 then
program.chat.personal("list")
local group_name = base.gui.input("Group name to join?")
local group_exists = false;
if group_name then
for _,v in ipairs(group_list) do
if v == group_name then
group_exists = true;
end
end
end
if not group_exists then
local ok = base.gui.confirm("Group not found, create it?")
if ok then
local ok, err = Discover.Chat:Send("group", group_name, "Group created by: " .. tostring(Discover.User.Data.Username), true)
if ok then
base.gui.alert("Created new group, joining...")
sleep(1)
program.chat.group(group_name)
else
base.gui.alert("Failed:" .. tostring(err))
sleep(1.5)
program.chat.main()
end
else
base.gui.alert("Not created, returning...")
sleep(0.5)
program.chat.main();
end
end
elseif (args[3] >= 23 and args[3] <= 51) and (args[4] >= 4 and args[4] <= 17) then
local id = args[4] - 3 + scroll
if id <= #group_list then
program.chat.group(group_list[id])
end
end
elseif args[1] == "mouse_scroll" then
if downloaded_groups then
if args[2] == -1 then
if scroll > 0 then
scroll = scroll - 1
render();
end
elseif args[2] == 1 then
if scroll+14 < #group_list then
scroll = scroll + 1
render();
end
end
end
end
end
......
......@@ -217,10 +217,9 @@ Discover = {
req = textutils.unserialize(req.readAll())
if req.status then
self.Data.CMessage = tostring(req.message)
return true
return unpack({true,req.message});
else
self.Data.ErrorMsg = req.error
return false
return unpack({false,req.error});
end
else
self.Data.ErrorMsg = "Please supply a username, password and email!"
......@@ -366,11 +365,101 @@ Discover = {
end;
};
Chat = {
Send = function( self, ctype, cid, message )
-- ChatID can be username, group or 'global'
Send = function( self, ctype, cid, message, create, async )
if ctype == "global" then
if async then
local query = "cmd=chat-send&key=" .. textutils.urlEncode(tostring(Discover.User.Data.AuthKey)) .. "&ntype=global&message=" .. textutils.urlEncode(tostring(cid));
http.request(Discover.Data.Urls.Store, query, Discover.Data.Header);
return true;
else
local query = "cmd=chat-send&key=" .. textutils.urlEncode(tostring(Discover.User.Data.AuthKey)) .. "&ntype=global&message=" .. textutils.urlEncode(tostring(cid));
local req = http.post(Discover.Data.Urls.Store, query, Discover.Data.Headers)
local req = textutils.unserialize(req.readAll())
if req.status then
return unpack({true, req.data})
else
return unpack({false, req.error})
end
end
elseif ctype == "group" then
if async then
local query = "";
if create then
query = "cmd=chat-send&create=true&key=" .. textutils.urlEncode(tostring(Discover.User.Data.AuthKey)) .. "&ntype=group&cid=" .. textutils.urlEncode(tostring(cid)) .. "&message=" .. textutils.urlEncode(tostring(message));
else
query = "cmd=chat-send&key=" .. textutils.urlEncode(tostring(Discover.User.Data.AuthKey)) .. "&ntype=group&cid=" .. textutils.urlEncode(tostring(cid)) .. "&message=" .. textutils.urlEncode(tostring(message));
end
http.request(Discover.Data.Urls.Store, query, Discover.Data.Header);
return true;
else
local query = "";
if create then
query = "cmd=chat-send&create=true&key=" .. textutils.urlEncode(tostring(Discover.User.Data.AuthKey)) .. "&ntype=group&cid=" .. textutils.urlEncode(tostring(cid)) .. "&message=" .. textutils.urlEncode(tostring(message));
else
query = "cmd=chat-send&key=" .. textutils.urlEncode(tostring(Discover.User.Data.AuthKey)) .. "&ntype=group&cid=" .. textutils.urlEncode(tostring(cid)) .. "&message=" .. textutils.urlEncode(tostring(message));
end
local req = http.post(Discover.Data.Urls.Store, query, Discover.Data.Headers)
local req = textutils.unserialize(req.readAll())
if req.status then
return unpack({true, req.data})
else
return unpack({false, req.error})
end
end
end
end;
View = function( self, ctype, cid, async )
if ctype == "global" then
if async then
local query = "cmd=chat-list&key=" .. textutils.urlEncode(tostring(Discover.User.Data.AuthKey)) .. "&ntype=global";
http.request(Discover.Data.Urls.Store, query, Discover.Data.Headers)
else
local query = "cmd=chat-list&key=" .. textutils.urlEncode(tostring(Discover.User.Data.AuthKey)) .. "&ntype=global";
local req = http.post(Discover.Data.Urls.Store, query, Discover.Data.Headers)
local req = textutils.unserialize(req.readAll())
if req.status then
return unpack({true, req.data})
else
return unpack({false, req.error})
end
end
elseif ctype == "group" then
if async then
local query = "cmd=chat-list&key=" .. textutils.urlEncode(tostring(Discover.User.Data.AuthKey)) .. "&ntype=group&cid=" .. textutils.urlEncode(tostring(cid));
http.request(Discover.Data.Urls.Store, query, Discover.Data.Headers)
else
local query = "cmd=chat-list&key=" .. textutils.urlEncode(tostring(Discover.User.Data.AuthKey)) .. "&ntype=group&cid=" .. textutils.urlEncode(tostring(cid));
local req = http.post(Discover.Data.Urls.Store, query, Discover.Data.Headers)
local req = textutils.unserialize(req.readAll())
if req.status then
return unpack({true, req.data})
else
return unpack({false, req.error})
end
end
end
end;
View = function( self, ctype, cid )
-- ChatID can be username, group or 'global'
List = function( self, ntype )
if ntype == "group" then
local query = "cmd=chat-list-groups&key=" .. textutils.urlEncode(tostring(Discover.User.Data.AuthKey));
local req = http.post(Discover.Data.Urls.Store, query, Discover.Data.Headers)
local req = textutils.unserialize(req.readAll())
if req.status then
return unpack({true, req.data})
else
return unpack({false, req.error})
end
end
end;
Handle = function( self, data )
if data then
local data = textutils.unserialize(data)
if data.status then
return unpack({true, data.data});
else
return unpack({false, data.error});
end
end
end;
};
Forums = {
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
// Import modules
require("modules/database.php");
require("modules/utils.php");
require("modules/preset_emails.php");
// Increment Counter
$accsql2 = "UPDATE `cc__stats` SET `accessed` = accessed + 1 WHERE `id` = 1";
$conn->query($accsql2);
// Increment Counter
$accsql2 = "UPDATE `cc__stats` SET `pastebin` = pastebin + 1 WHERE `id` = 1";
$conn->query($accsql2);
// Set Base URLs
$pastebin_login = 'http://pastebin.com/api/api_login.php';
$pastebin_api = 'http://pastebin.com/api/api_post.php';