Commit 2ff0adfd authored by Danny SMc's avatar Danny SMc

Amended most, added chat system with API

parent 8cad4fec
ew0KICB7DQogICAgZmlsZW5hbWUgPSAiZmlsZW1hbmFnZXIubHVhIiwNCiAgICBuYW1lID0gIkZpbGVNYW5hZ2VyIiwNCiAgICByZWxlYXNlZCA9ICIxOC8wNy8yMDE2IiwNCiAgfSwNCn0=
\ No newline at end of file
ewogIENvbmZpZyA9IHsKICAgIFVzZUJldGFVcGRhdGVTdHJlYW0gPSBmYWxzZSwKICAgIFBsdWdpbnNEaXJlY3RvcnkgPSAiL0RBX1BsdWdpbnMiLAogICAgRW5hYmxlUGx1Z2lucyA9IHRydWUsCiAgICBFeGFtcGxlU2V0dGluZyA9IHRydWUsCiAgICBDb25maWdGaWxlUGF0aCA9ICIuRGlzY292ZXJDb25maWciLAogICAgQmxvY2tUZXJtaW5hdGUgPSBmYWxzZSwKICAgIFBsdWdpbkNvbmZpZ0ZpbGUgPSAiLkRpc2NvdmVyQXBwUGx1Z2lucyIsCiAgICBBdXRvVXBkYXRlID0gZmFsc2UsCiAgfSwKICBBY2NvdW50ID0gewogICAgUGFzc3dvcmQgPSAiYWQ0ZmFhMjU2MzY3Y2EzZTc5ZGZiNDAwMGQyMWQ3ZTI4MzQwMGJiZjI4Y2YzMjhhNzA1MWRiYmZhNDU4YjdkOCIsCiAgICBVc2VybmFtZSA9ICJkYW5ueXNtYzk1IiwKICB9LAp9
\ No newline at end of file
--[[
Name: FileManager Plugin
Desc: A powerful file manager
Auth: DannySMc
]]
-- @base filemanager
-- @func entry
Plugin.filemanager = {};
function Plugin.filemanager.entry()
local filemanagericon = {
{"a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: "};
{"a:a: ","0:a:F","0:a:i","0:a:l","0:a:e","0:a: ","0:a: ","0:a: ","0:a: ","0:a: ","a:4: ","a:5: ","a:5: ","0:a: "};
{"a:a: ","0:a: ","0:a:M","0:a:a","0:a:n","0:a:a","0:a:g","0:a:e","0:a:r","0:a: ","0:4: ","a:4: ","a:4: ","a:a: "};
{"a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: ","a:a: "};
};
DiscoverApp.Register.MenuIcon("FileManager", filemanagericon);
DiscoverApp.Register.MenuEntry("FileManager", "filemanager", "main", "Files", false);
end
function program.filemanager.main()
base.screen.colour("white")
program.draw.menubar("Files: Main")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.textr("Exit ", 19, false, "red", "grey")
local scroll = 0;
local path = "/";
local history = {};
local fileList = {};
base.draw.textl(" < >", 3, false, "lightBlue", "white")
base.draw.texta("::" .. tostring(path):sub(1, 42), 6, 3, false, "lightGrey", "white")
local function parse(path)
if fs.exists(path) then
table.insert(history, path)
end
local list = fs.list(path)
local new = {}
for _,v in ipairs(list) do
if fs.isDir(fs.combine(path, v)) then
table.insert(new, "+" .. tostring(v))
end
end
for _,v in ipairs(list) do
if not fs.isDir(fs.combine(path, v)) then
table.insert(new, "-" .. tostring(v))
end
end
fileList = new;
return new;
end
local function render(data)
base.draw.texta("::" .. tostring(path):sub(1, 42), 6, 3, false, "lightGrey", "white")
for i=1, 13 do
base.draw.box(1, 30, i+4, 1, " ", "white", "white")
if i+scroll <= #data then
if data[i+scroll]:sub(1,1) == "+" then
base.draw.textl(" " .. tostring(data[i+scroll]:sub(2)), i+4, false, "blue", "white")
elseif data[i+scroll]:sub(1,1) == "-" then
base.draw.textl(" " .. tostring(data[i+scroll]:sub(2)), i+4, false, "lightGrey", "white")
end
end
end
end
render(parse(path));
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Files: Main")
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Files: Main", args[3], args[4])
elseif (args[3] >= 47 and args[3] <= 50) and (args[4] == 19) then
base.thread.remove("Files")
base.thread.switch("Home")
elseif (args[3] >= 2 and args[3] <= 40) and (args[4] >= 5 and args[4] <= 17) then
local id = args[4] - 4 + scroll
if #fileList >= id then
local newpath = fs.combine(path, fileList[id])
if fs.isDir(newpath) then
path = newpath;
render(parse(path))
else
end
end
end
elseif args[1] == "mouse_scroll" then
if args[2] == -1 then
if scroll > 0 then
scroll = scroll - 1
render(parse(path))
end
elseif args[2] == 1 then
if scroll+13 < #fileList then
scroll = scroll + 1
render(parse(path))
end
end
end
end
end
\ No newline at end of file
Finder Finder
-> Add click support -> Add click support
Help FAQ
-> Document everything
Chat Rooms Chat Rooms
-> Add the screens into this -> Add the screens into this
\ No newline at end of file
DAPI
-> Add FAQ/Help Insertions
-> Add Credits Insertions
PHP-API:
-> Check user account failure and callbacks
\ No newline at end of file
...@@ -55,7 +55,8 @@ function program.account.register() ...@@ -55,7 +55,8 @@ function program.account.register()
elseif (args[3] >= 43 and args[3] <= 50) and (args[4] == 19) then elseif (args[3] >= 43 and args[3] <= 50) and (args[4] == 19) then
if username and password and email then if username and password and email then
base.draw.textc("Requesting Authentication, Please Wait", 17, false, "lightGrey", "white") 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") base.gui.alert("Registered. Obtaining authkey, please wait")
sleep(0.5) sleep(0.5)
local status = Discover.User:Login(username, password) local status = Discover.User:Login(username, password)
...@@ -72,7 +73,7 @@ function program.account.register() ...@@ -72,7 +73,7 @@ function program.account.register()
end end
else else
base.draw.box(1, 51, 17, 1, " ", "white", "white") 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) sleep(1)
base.thread.remove("Account") base.thread.remove("Account")
base.thread.switch("Home") base.thread.switch("Home")
......
...@@ -47,7 +47,6 @@ local paths = { ...@@ -47,7 +47,6 @@ local paths = {
"cloud/cloud.main.lua"; "cloud/cloud.main.lua";
"mail/mail.main.lua"; "mail/mail.main.lua";
"chat/chat.main.lua"; "chat/chat.main.lua";
"chat/chat.personal.lua";
"chat/chat.group.lua"; "chat/chat.group.lua";
"chat/chat.global.lua"; "chat/chat.global.lua";
"chat/chat.info.lua"; "chat/chat.info.lua";
......
...@@ -3,43 +3,24 @@ ...@@ -3,43 +3,24 @@
Desc: Main chat group viewer Desc: Main chat group viewer
--]] --]]
function program.chat.group(screen) function program.chat.group(gid)
if screen == "list" then base.screen.colour("white")
base.screen.colour("white") program.draw.menubar("Chat: Group")
program.draw.menubar("Chat: Group") base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey") base.draw.textr("Exit ", 19, false, "red", "grey")
base.draw.textr("Exit ", 19, false, "red", "grey")
while true do base.draw.textc(tostring(gid), 10, false, "red", "white")
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")
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")
while true do while true do
local args = { os.pullEvent() } local args = { os.pullEvent() }
if args[1] == "timer" then if args[1] == "timer" then
program.draw.menubar("Chat: Group::View") program.draw.menubar("Chat: Group")
elseif args[1] == "mouse_click" then elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Group::View", args[3], args[4]) program.draw.menu.handler("Chat: Group", args[3], args[4])
elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then
base.thread.remove("Profile") base.thread.remove("Profile")
base.thread.switch("Home") base.thread.switch("Home")
end
end end
end end
end end
......
...@@ -10,8 +10,31 @@ function program.chat.main() ...@@ -10,8 +10,31 @@ function program.chat.main()
base.draw.textr("Exit ", 19, false, "red", "grey") base.draw.textr("Exit ", 19, false, "red", "grey")
base.draw.textl(" About", 19, false, "orange", "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 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, 22 do base.draw.box(i, 1, 3, 16, false, "lightGrey", "lightGrey"); end
for i=1, (#options*2), 2 do for i=1, (#options*2), 2 do
count = count + 1; count = count + 1;
...@@ -34,9 +57,53 @@ function program.chat.main() ...@@ -34,9 +57,53 @@ function program.chat.main()
elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 4 then elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 4 then
program.chat.global() program.chat.global()
elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 6 then elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 6 then
program.chat.group("list") local group_name = base.gui.input("Group name to join?")
elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 8 then local group_exists = false;
program.chat.personal("list") 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 end
end end
......
--[[
Name: chat.personal
Desc: Main chat personal viewer
--]]
function program.chat.personal()
if screen == "list" then
base.screen.colour("white")
program.draw.menubar("Chat: Personal")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.textr("Exit ", 19, false, "red", "grey")
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Chat: Personal")
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Personal", 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")
end
end
end
elseif screen == "view" then
base.screen.colour("white")
program.draw.menubar("Chat: Personal::View")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.textr("Exit ", 19, false, "red", "grey")
while true do
local args = { os.pullEvent() }
if args[1] == "timer" then
program.draw.menubar("Chat: Personal::View")
elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Personal::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")
end
end
end
end
end
\ No newline at end of file
...@@ -217,10 +217,9 @@ Discover = { ...@@ -217,10 +217,9 @@ Discover = {
req = textutils.unserialize(req.readAll()) req = textutils.unserialize(req.readAll())
if req.status then if req.status then
self.Data.CMessage = tostring(req.message) self.Data.CMessage = tostring(req.message)
return true return unpack({true,req.message});
else else
self.Data.ErrorMsg = req.error return unpack({false,req.error});
return false
end end
else else
self.Data.ErrorMsg = "Please supply a username, password and email!" self.Data.ErrorMsg = "Please supply a username, password and email!"
...@@ -366,11 +365,64 @@ Discover = { ...@@ -366,11 +365,64 @@ Discover = {
end; end;
}; };
Chat = { Chat = {
Send = function( self, ctype, cid, message ) Send = function( self, ctype, cid, message, create )
-- ChatID can be username, group or 'global' if ctype == "global" then
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
elseif ctype == "group" 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
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 ) View = function( self, ctype, cid )
-- ChatID can be username, group or 'global' if ctype == "global" then
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
elseif ctype == "group" then
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;
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; end;
}; };
Forums = { Forums = {
......
...@@ -4968,8 +4968,31 @@ function program.chat.main() ...@@ -4968,8 +4968,31 @@ function program.chat.main()
base.draw.textr("Exit ", 19, false, "red", "grey") base.draw.textr("Exit ", 19, false, "red", "grey")
base.draw.textl(" About", 19, false, "orange", "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 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, 22 do base.draw.box(i, 1, 3, 16, false, "lightGrey", "lightGrey"); end
for i=1, (#options*2), 2 do for i=1, (#options*2), 2 do
count = count + 1; count = count + 1;
...@@ -4992,55 +5015,52 @@ function program.chat.main() ...@@ -4992,55 +5015,52 @@ function program.chat.main()
elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 4 then elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 4 then
program.chat.global() program.chat.global()
elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 6 then elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 6 then
program.chat.group("list") local group_name = base.gui.input("Group name to join?")
elseif (args[3] >= 2 and args[3] <= 21) and args[4] == 8 then local group_exists = false;
program.chat.personal("list") if group_name then
end for _,v in ipairs(group_list) do
end if v == group_name then
end group_exists = true;
end end
end
--[[ end
Name: chat.personal if not group_exists then
Desc: Main chat personal viewer 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)
function program.chat.personal() if ok then
if screen == "list" then base.gui.alert("Created new group, joining...")
base.screen.colour("white") sleep(1)
program.draw.menubar("Chat: Personal") program.chat.group(group_name)
base.draw.box(1, 51, 19, 1, " ", "grey", "grey") else
base.draw.textr("Exit ", 19, false, "red", "grey") base.gui.alert("Failed:" .. tostring(err))
sleep(1.5)
while true do program.chat.main()
local args = { os.pullEvent() } end
if args[1] == "timer" then else
program.draw.menubar("Chat: Personal") base.gui.alert("Not created, returning...")
elseif args[1] == "mouse_click" then sleep(0.5)
if args[4] >= 1 and args[4] <= 2 then program.chat.main();
program.draw.menu.handler("Chat: Personal", args[3], args[4]) end
elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then end
base.thread.remove("Profile") elseif (args[3] >= 23 and args[3] <= 51) and (args[4] >= 4 and args[4] <= 17) then
base.thread.switch("Home") local id = args[4] - 3 + scroll
if id <= #group_list then
program.chat.group(group_list[id])
end end
end end
end elseif args[1] == "mouse_scroll" then
elseif screen == "view" then if downloaded_groups then
base.screen.colour("white") if args[2] == -1 then
program.draw.menubar("Chat: Personal::View") if scroll > 0 then
base.draw.box(1, 51, 19, 1, " ", "grey", "grey") scroll = scroll - 1
base.draw.textr("Exit ", 19, false, "red", "grey") render();
end
while true do elseif args[2] == 1 then
local args = { os.pullEvent() } if scroll+14 < #group_list then
if args[1] == "timer" then scroll = scroll + 1
program.draw.menubar("Chat: Personal::View") render();
elseif args[1] == "mouse_click" then end
if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Personal::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")
end end
end end
end end
...@@ -5052,43 +5072,24 @@ end ...@@ -5052,43 +5072,24 @@ end
Desc: Main chat group viewer Desc: Main chat group viewer
--]] --]]
function program.chat.group(screen) function program.chat.group(gid)
if screen == "list" then base.screen.colour("white")
base.screen.colour("white") program.draw.menubar("Chat: Group")
program.draw.menubar("Chat: Group") base.draw.box(1, 51, 19, 1, " ", "grey", "grey")
base.draw.box(1, 51, 19, 1, " ", "grey", "grey") base.draw.textr("Exit ", 19, false, "red", "grey")
base.draw.textr("Exit ", 19, false, "red", "grey")
while true do base.draw.textc(tostring(gid), 10, false, "red", "white")
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")
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")
while true do while true do
local args = { os.pullEvent() } local args = { os.pullEvent() }
if args[1] == "timer" then if args[1] == "timer" then
program.draw.menubar("Chat: Group::View") program.draw.menubar("Chat: Group")
elseif args[1] == "mouse_click" then elseif args[1] == "mouse_click" then
if args[4] >= 1 and args[4] <= 2 then if args[4] >= 1 and args[4] <= 2 then
program.draw.menu.handler("Chat: Group::View", args[3], args[4]) program.draw.menu.handler("Chat: Group", args[3], args[4])
elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then elseif (args[3] >= 47 and args[3] <= 50) and args[4] == 19 then
base.thread.remove("Profile") base.thread.remove("Profile")
base.thread.switch("Home") base.thread.switch("Home")
end
end end
end end
end end
...@@ -5976,7 +5977,8 @@ function program.account.register() ...@@ -5976,7 +5977,8 @@ function program.account.register()
elseif (args[3] >= 43 and args[3] <= 50) and (args[4] == 19) then elseif (args[3] >= 43 and args[3] <= 50) and (args[4] == 19) then
if username and password and email then if username and password and email then
base.draw.textc("Requesting Authentication, Please Wait", 17, false, "lightGrey", "white") 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") base.gui.alert("Registered. Obtaining authkey, please wait")
sleep(0.5) sleep(0.5)
local status = Discover.User:Login(username, password) local status = Discover.User:Login(username, password)
...@@ -5993,7 +5995,7 @@ function program.account.register() ...@@ -5993,7 +5995,7 @@ function program.account.register()
end