[geary/mjog/746-gmail-flag-quote-bug: 17/20] Geary.Imap.Deserializer: Rework tag handling



commit 865765a24fd508a6665eb7f8c94aa8964bbf1d56
Author: Michael Gratton <mike vee net>
Date:   Sat May 2 12:06:45 2020 +1000

    Geary.Imap.Deserializer: Rework tag handling
    
    Now that `DataFormat.is_tag_special` actually does what it says on the
    tin, fix deser to work with that correctly.

 src/engine/imap/transport/imap-deserializer.vala | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/engine/imap/transport/imap-deserializer.vala 
b/src/engine/imap/transport/imap-deserializer.vala
index bf45c81d..014d73ae 100644
--- a/src/engine/imap/transport/imap-deserializer.vala
+++ b/src/engine/imap/transport/imap-deserializer.vala
@@ -589,20 +589,22 @@ public class Geary.Imap.Deserializer : BaseObject, Logging.Source {
     private uint on_tag_char(uint state, uint event, void *user) {
         char ch = *((char *) user);
 
-        // drop if not allowed for tags (allowing for continuations and watching for spaces, which
-        // indicate a change of state)
-        if (DataFormat.is_tag_special(ch, " +"))
+        if (is_current_string_empty() &&
+            (ch == '*' || ch == '+')) {
+            // At first tag character. Allow a single `*` to indicate
+            // an untagged response or a `+` here for continuations
+            append_to_string(ch);
             return State.TAG;
+        }
 
-        // space indicates end of tag
-        if (ch == ' ') {
+        // Any tag special here indicates end-of-tag, so save and work
+        // out where to go next
+        if (DataFormat.is_tag_special(ch)) {
             save_string_parameter(false);
-
-            return State.START_PARAM;
+            return on_first_param_char(state, event, user);
         }
 
         append_to_string(ch);
-
         return State.TAG;
     }
 


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