More reliable serverlist behaviour
authorHybridDog <adresse_test@t-online.de>
Sat, 30 May 2015 14:18:09 +0000 (16:18 +0200)
committerest31 <MTest31@outlook.com>
Tue, 9 Jun 2015 14:44:43 +0000 (16:44 +0200)
-> remember the previously loaded serverlist, and use if new one failed
-> show a "loading" serverlist

builtin/mainmenu/common.lua

index d6e2588fad640b363771ef66bf548600bc43e73e..6126c61a41b213f7abe77291585fd4cef595a3ce 100644 (file)
@@ -234,7 +234,13 @@ end
 --------------------------------------------------------------------------------
 function asyncOnlineFavourites()
 
-       menudata.favorites = {}
+       if not menudata.public_known then
+               menudata.public_known = {{
+                       name = fgettext("Loading..."),
+                       description = fgettext("Try reenabling public serverlist and check your internet connection.")
+               }}
+       end
+       menudata.favorites = menudata.public_known
        core.handle_async(
                function(param)
                        return core.get_favorites("online")
@@ -242,11 +248,15 @@ function asyncOnlineFavourites()
                nil,
                function(result)
                        if core.setting_getbool("public_serverlist") then
-                               menudata.favorites = order_favorite_list(result)
+                               local favs = order_favorite_list(result)
+                               if favs[1] then
+                                       menudata.public_known = favs
+                                       menudata.favorites = menudata.public_known
+                               end
                                core.event_handler("Refresh")
                        end
                end
-               )
+       )
 end
 
 --------------------------------------------------------------------------------