Change Session plugin to keep track of the current session
authorChip Black <bytex64@bytex64.net>
Tue, 9 Jun 2009 06:35:45 +0000 (01:35 -0500)
committerChip Black <bytex64@bytex64.net>
Tue, 9 Jun 2009 06:35:45 +0000 (01:35 -0500)
plugins/Session.cs

index 37d848c..bec316f 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);
         }
     }