[smuxi/experiments/new_chat_sync_manager: 2/5] Frontend: /rejoin didn't work with ChatViewSyncManager due calling Sync while already synced



commit ee2f656a69db95eb46ade1f2564fdec69038fc39
Author: Oliver Schneider <mail oli-obk de>
Date:   Sat Jul 19 18:56:45 2014 +0200

    Frontend: /rejoin didn't work with ChatViewSyncManager due calling Sync while already synced

 src/Frontend/ChatViewSyncManager.cs |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/src/Frontend/ChatViewSyncManager.cs b/src/Frontend/ChatViewSyncManager.cs
index ba77aa5..2aae035 100644
--- a/src/Frontend/ChatViewSyncManager.cs
+++ b/src/Frontend/ChatViewSyncManager.cs
@@ -34,12 +34,16 @@ namespace Smuxi.Frontend
 #endif
 
         /*
+         * TODO DisableChat is not in this system
+         * TODO DisableChat should SyncState ---Disable---> WaitingForSyncState
+         *
          * InitialState ---Add---> AddedState
          * AddedState ---Sync---> SyncQueuedState
          *                  ---ReadyToSync---> WaitingForSyncState
          * SyncQueuedState ---ReadyToSync---> SyncingState
          * WaitingForSyncState ---Sync---> SyncingState
          * SyncingState ---SyncFinished---> SyncState
+         * SyncState ---Sync---> SyncingState
          *
          * AddedState ---Remove---> RemovingState
          * SyncQueuedState ---Remove---> RemovingState
@@ -66,27 +70,27 @@ namespace Smuxi.Frontend
 
             public virtual void ExecuteAdd()
             {
-                throw new InvalidStateException("could not add");
+                throw new InvalidStateException("could not add in " + this.GetType().Name);
             }
             public virtual void ExecuteRemove()
             {
-                throw new InvalidStateException("could not remove");
+                throw new InvalidStateException("could not remove in " + this.GetType().Name);
             }
             public virtual void ExecuteRemoveFinished()
             {
-                throw new InvalidStateException("could not remove");
+                throw new InvalidStateException("could not remove in " + this.GetType().Name);
             }
             public virtual void ExecuteSync()
             {
-                throw new InvalidStateException("could not sync");
+                throw new InvalidStateException("could not sync in " + this.GetType().Name);
             }
             public virtual void ExecuteReadyToSync()
             {
-                throw new InvalidStateException("could not be ready to sync");
+                throw new InvalidStateException("could not be ready to sync in " + this.GetType().Name);
             }
             public virtual void ExecuteSyncFinished()
             {
-                throw new InvalidStateException("could not finish sync");
+                throw new InvalidStateException("could not finish sync in " + this.GetType().Name);
             }
         }
 
@@ -227,6 +231,13 @@ namespace Smuxi.Frontend
                 Trace.Call(Chat.ChatModel);
                 Chat.SetState<RemovingState>();
             }
+
+            public override void ExecuteSync()
+            {
+                // this happens for example in /rejoin
+                Trace.Call(Chat.ChatModel);
+                Chat.SetState<SyncingState>();
+            }
         }
 
         class RemovingState : State
@@ -688,7 +699,7 @@ namespace Smuxi.Frontend
 
     public class InvalidStateException : Exception
     {
-        public InvalidStateException(string msg)
+        internal InvalidStateException(string msg)
             :base(msg)
         {
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]