Get rid of Vimish configuration autosave. It was a silly idea.
[WebThing.git] / plugins / Session.cs
index 37d848c..559f250 100644 (file)
@@ -5,12 +5,14 @@ using bytex64.WebThing;
 
 public class Session : WebThingPlugin {
     WebThing wt;
+    string CurrentSession = "Default";
 
     public override void Init(WebThing wt) {
         this.wt = wt;
         if (Config.Arguments.Length == 0) {
             if (Config.Options.ContainsKey("Session")) {
                 RestoreSession(Config.Options["Session"]);
+                CurrentSession = Config.Options["Session"];
             } else if (Options.ContainsKey("Default")) {
                 RestoreSession("Default");
             }
@@ -19,7 +21,7 @@ public class Session : WebThingPlugin {
 
     public override void Deinit(WebThing wt) {
         if (Options.ContainsKey("AutoSave") && Config.ParseBool(Options["AutoSave"])) {
-            SaveSession("Default");
+            SaveSession(CurrentSession);
         }
     }
 
@@ -47,4 +49,9 @@ public class Session : WebThingPlugin {
         Options[SessionName] = String.Join(" ", Uris.ToArray());
         SaveConfig();
     }
+
+    public void DeleteSession(string SessionName) {
+        Options.Remove(SessionName);
+        SaveConfig();
+    }
 }