Revert "Fix serverlist not beeing escaped correctly"

This reverts commit 39d03148e5d98ef5f9a31b131a79ff2bbd71a877.
This commit is contained in:
kwolekr 2013-07-08 20:21:09 -04:00
parent eedb29346e
commit e1a13608d8
3 changed files with 19 additions and 16 deletions

@ -52,6 +52,12 @@ function render_favourite(spec)
details = details .. " " details = details .. " "
end end
if spec.port ~= nil then
text = text .. ":" .. spec.port:trim()
else
text = text .. ":??"
end
return text return text
end end
@ -113,8 +119,6 @@ function cleanup_path(temppath)
return temppath return temppath
end end
--------------------------------------------------------------------------------
function menu.set_texture(identifier,gamedetails) function menu.set_texture(identifier,gamedetails)
local texture_set = false local texture_set = false
if menu.texturepack ~= nil and gamedetails ~= nil then if menu.texturepack ~= nil and gamedetails ~= nil then
@ -700,7 +704,10 @@ function tabbuilder.handle_multiplayer_buttons(fields)
end end
if event.typ == "CHG" then if event.typ == "CHG" then
local address = menu.favorites[event.index].address local address = menu.favorites[event.index].name
if address == nil then
address = menu.favorites[event.index].address
end
local port = menu.favorites[event.index].port local port = menu.favorites[event.index].port
if address ~= nil and if address ~= nil and
@ -1139,6 +1146,7 @@ function tabbuilder.tab_multiplayer()
end end
end end
print("cfav: " .. dump(menu.fav_selected))
if menu.fav_selected ~= nil then if menu.fav_selected ~= nil then
retval = retval .. ";" .. menu.fav_selected .. "]" retval = retval .. ";" .. menu.fav_selected .. "]"
else else
@ -1181,11 +1189,10 @@ function tabbuilder.tab_server()
retval = retval .. "," .. menu.worldlist[i].name .. retval = retval .. "," .. menu.worldlist[i].name ..
" \\[" .. menu.worldlist[i].gameid .. "\\]" " \\[" .. menu.worldlist[i].gameid .. "\\]"
end end
retval = retval .. ";" .. index .. "]"
else
retval = retval .. ";0]"
end end
retval = retval .. ";" .. index .. "]"
return retval return retval
end end
@ -1214,8 +1221,7 @@ end
function tabbuilder.tab_singleplayer() function tabbuilder.tab_singleplayer()
local index = engine.setting_get("main_menu_singleplayer_world_idx") local index = engine.setting_get("main_menu_singleplayer_world_idx")
if index == nil or if index == nil then
#menu.filtered_game_list_raw() == 0 then
index = 0 index = 0
end end

@ -77,11 +77,9 @@ function fs_escape_string(text)
text = newtext text = newtext
end end
text = string.gsub(text,"\\","\\\\") text = text:gsub("%[","\\%[")
text = string.gsub(text,"%]","\\]") text = text:gsub("]","\\]")
text = string.gsub(text,"%[","\\[") text = text:gsub(";","\\;")
text = string.gsub(text,";","\\;")
text = string.gsub(text,",","\\,")
end end
return text return text
end end

@ -611,7 +611,7 @@ void GUIFormSpecMenu::parseTextList(parserData* data,std::string element) {
std::vector<std::string> v_pos = split(parts[0],','); std::vector<std::string> v_pos = split(parts[0],',');
std::vector<std::string> v_geom = split(parts[1],','); std::vector<std::string> v_geom = split(parts[1],',');
std::string name = parts[2]; std::string name = parts[2];
std::vector<std::string> items = split(parts[3],',',true); std::vector<std::string> items = split(parts[3],',');
std::string str_initial_selection = ""; std::string str_initial_selection = "";
std::string str_transparent = "false"; std::string str_transparent = "false";
@ -1352,7 +1352,6 @@ void GUIFormSpecMenu::parseBox(parserData* data,std::string element) {
} }
void GUIFormSpecMenu::parseElement(parserData* data,std::string element) { void GUIFormSpecMenu::parseElement(parserData* data,std::string element) {
//some prechecks //some prechecks
if (element == "") if (element == "")
return; return;