Why does the windows platform have a logoutMenu but linux and mac not?

I was curirous why I wasnt seeing the “Logout” and “Logout with reason” menu options on linux, and came across this code:

if (Spark.isWindows()) {

connectMenu.add(logoutMenuItem);

connectMenu.add(logoutWithStatus);

}

connectMenu.addSeparator();

if (!Spark.isMac()) {

connectMenu.add(exitMenuItem);

}

in the file MainWindow.java

Surely it should be reasonable for all platforms to have a logout, and for the mac to have an exit menu item?

Sam.

It’s due to how Spark logouts.

The method that is called doesn’t work under linux because it calls a script that I’ve not seen.

Here is the code in org.jivesoftware.MainWindow.java:

private void closeConnectionAndInvoke() {
        final XMPPConnection con = SparkManager.getConnection();
        if (con.isConnected()) {
            con.disconnect();
        }         String sparkPath = null;
        try {
            String command = "";
            if (Spark.isWindows()) {
                String sparkExe = Spark.getBinDirectory().getParentFile().getCanonicalPath() + "\\Spark.exe";
                String starterExe = Spark.getBinDirectory().getParentFile().getCanonicalPath() + "\\starter.exe";                 command = starterExe + " \"" + sparkExe + "\"";
            }
            else if (Spark.isMac()) {
                command = "open -a Spark";
            }
            else if (Spark.isLinux()) {
                sparkPath = Spark.getBinDirectory().toString();
                command = System.getProperties().getProperty("user.home")+"/"+Spark.getUserConf()+"/bin/restarter";
            }             Runtime.getRuntime().exec(command);
        }
        catch (IOException e) {
            Log.error("Error starting Spark", e);
        }         System.exit(1);
    }

I have never seen the ‘restarter’ script. I’m sure one could be whipped up fairly fast though. Just not sure exactly if Spark has a way to force the login screen even when a user has autolog checked. I looked at possible arguments to pass to Spark and couldn’t see it there.

I haven’t a lot of time to look over it to much though. Maybe a patch and a script could be whipped up?

Not sure about the mac part. I’m not to familiar with Mac.

_Aaron

The issue on Macs, I think, is that open -a is an unreliable way to relaunch the application, particularly if multiple copies are installed. It’d be safer to get the actual path to the copy currently in use.