private void quit() { LOG.debug("quit called."); Events.eventBus().post(new QuitEvent()); // LanternHub.display().dispose(); // this.xmppHandler.disconnect(); System.exit(0); }
private void handleReset() { // This posts the reset event to any classes that need to take action, // avoiding coupling this class to those classes. Events.eventBus().post(new ResetEvent()); if (LanternClientConstants.DEFAULT_MODEL_FILE.isFile()) { try { FileUtils.forceDelete(LanternClientConstants.DEFAULT_MODEL_FILE); } catch (final IOException e) { log.warn("Could not delete model file?"); } } final Model base = new Model(model.getCountryService()); model.setEverGetMode(false); model.setLaunchd(base.isLaunchd()); model.setModal(base.getModal()); model.setNodeId(base.getNodeId()); model.setProfile(base.getProfile()); model.setNproxiedSitesMax(base.getNproxiedSitesMax()); // we need to keep clientID and clientSecret, because they are application-level settings String clientID = model.getSettings().getClientID(); String clientSecret = model.getSettings().getClientSecret(); model.setSettings(base.getSettings()); model.getSettings().setClientID(clientID); model.getSettings().setClientSecret(clientSecret); model.setSetupComplete(base.isSetupComplete()); model.setShowVis(base.isShowVis()); // model.setFriends(base.getFriends()); model.clearNotifications(); modelIo.write(); }
public static void syncRosterEntry(final LanternRosterEntry entry, final int index) { final String path = SyncPath.ROSTER.getPath() + "." + index; LOG.debug("Syncing roster entry at path {} with entry {}", path, entry); Events.eventBus().post(new SyncEvent(path, entry)); }
/** Convenience method for syncing the current modal with the frontend. */ public static void syncRoster(final Roster roster) { // This is done synchronously because we need the roster array on the // frontend to be in sync with the backend in order to index into it // on roster updates. Events.eventBus().post(new SyncEvent(SyncPath.ROSTER, roster.getEntries())); }