}}
end
menudata.favorites = menudata.public_known
+ menudata.favorites_is_public = true
core.handle_async(
function(param)
return core.get_favorites("online")
if favs[1] then
menudata.public_known = favs
menudata.favorites = menudata.public_known
+ menudata.favorites_is_public = true
end
core.event_handler("Refresh")
end
if not is_server_protocol_compat(server_proto_min, server_proto_max) then
local server_prot_ver_info
local client_prot_ver_info
- if server_proto_min ~= server_proto_max then
+ local s_p_min = server_proto_min or 13
+ local s_p_max = server_proto_max or 24
+ if s_p_min ~= s_p_max then
server_prot_ver_info = fgettext_ne("Server supports protocol versions between $1 and $2. ",
- server_proto_min or 13, server_proto_max or 24)
+ s_p_min, s_p_max)
else
server_prot_ver_info = fgettext_ne("Server enforces protocol version $1. ",
- server_proto_min or 13)
+ s_p_min)
end
if min_supp_proto ~= max_supp_proto then
client_prot_ver_info= fgettext_ne("We support protocol versions between version $1 and $2.",
local event = core.explode_table_event(fields["favourites"])
if event.type == "DCL" then
if event.row <= #menudata.favorites then
- if not is_server_protocol_compat_or_error(menudata.favorites[event.row].proto_min,
- menudata.favorites[event.row].proto_max) then
+ local fav = menudata.favorites[event.row]
+ if menudata.favorites_is_public and
+ not is_server_protocol_compat_or_error(
+ fav.proto_min, fav.proto_max) then
return true
end
- gamedata.address = menudata.favorites[event.row].address
- gamedata.port = menudata.favorites[event.row].port
+ gamedata.address = fav.address
+ gamedata.port = fav.port
gamedata.playername = fields["te_name"]
if fields["te_pwd"] ~= nil then
gamedata.password = fields["te_pwd"]
end
gamedata.selected_world = 0
- if menudata.favorites ~= nil then
- gamedata.servername = menudata.favorites[event.row].name
- gamedata.serverdescription = menudata.favorites[event.row].description
- end
+ gamedata.servername = fav.name
+ gamedata.serverdescription = fav.description
if gamedata.address ~= nil and
gamedata.port ~= nil then
asyncOnlineFavourites()
else
menudata.favorites = core.get_favorites("local")
+ menudata.favorites_is_public = false
end
tabdata.fav_selected = nil
return true
local current_favourite = core.get_table_index("favourites")
if current_favourite == nil then return end
core.delete_favorite(current_favourite)
- menudata.favorites = order_favorite_list(core.get_favorites())
+ menudata.favorites = core.get_favorites("local")
tabdata.fav_selected = nil
core.setting_set("address","")
menudata.favorites[fav_idx].address == fields["te_address"] and
menudata.favorites[fav_idx].port == fields["te_port"] then
- gamedata.servername = menudata.favorites[fav_idx].name
- gamedata.serverdescription = menudata.favorites[fav_idx].description
+ local fav = menudata.favorites[fav_idx]
+ gamedata.servername = fav.name
+ gamedata.serverdescription = fav.description
- if not is_server_protocol_compat_or_error(menudata.favorites[fav_idx].proto_min,
- menudata.favorites[fav_idx].proto_max)then
+ if menudata.favorites_is_public and
+ not is_server_protocol_compat_or_error(
+ fav.proto_min, fav.proto_max) then
return true
end
else
asyncOnlineFavourites()
else
menudata.favorites = core.get_favorites("local")
+ menudata.favorites_is_public = false
end
end
asyncOnlineFavourites()
else
menudata.favorites = core.get_favorites("local")
+ menudata.favorites_is_public = false
end
return true
end
if fav_idx ~= nil and fav_idx <= #menudata.favorites and
menudata.favorites[fav_idx].address == fields["te_address"] and
menudata.favorites[fav_idx].port == fields["te_port"] then
+ local fav = menudata.favorites[fav_idx]
- gamedata.servername = menudata.favorites[fav_idx].name
- gamedata.serverdescription = menudata.favorites[fav_idx].description
+ gamedata.servername = fav.name
+ gamedata.serverdescription = fav.description
- if not is_server_protocol_compat_or_error(menudata.favorites[fav_idx].proto_min,
- menudata.favorites[fav_idx].proto_max) then
+ if menudata.favorites_is_public and
+ not is_server_protocol_compat_or_error(
+ fav.proto_min, fav.proto_max) then
return true
end
else
asyncOnlineFavourites()
else
menudata.favorites = core.get_favorites("local")
+ menudata.favorites_is_public = false
end
end