Bug 30042

Summary: XmppReader treats nodes containing only whitespace as empty nodes.
Product: Wocky Reporter: Will Thompson <will>
Component: GeneralAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/wjt/wocky.git;a=commitdiff;h=refs/heads/whitespace-only-bodies
Whiteboard:
i915 platform: i915 features:

Description Will Thompson 2010-09-06 05:53:29 UTC
WockyXmppReader seems to treat "<foo>    </foo>" as equivalent to "<foo/>".

This seems harmless, but... it breaks sending people messages containing only whitespace. It's surprising, and I think wrong, that if I send "   " to a contact who uses Gabble, they don't actually get notified for the message I sent them.

By contrast, the padding in "<body>  hai  </body>" is included in the node's content.
Comment 2 Will Thompson 2010-09-06 05:57:54 UTC
I think that this might be caused by Wocky not implementing the ignorableWhitespace xmlSAXHandler vfunc.
Comment 3 Will Thompson 2010-09-20 10:20:38 UTC
Well, the libxml2 documentation on this stuff is terrible.

Even if I implement it, _ignorable_whitespace() is never called. Some searching threw up references to xmlKeepBlanksDefault(), but it appears to make no difference. I think we might be able to feed it a schema that mandates that all whitespace is significant, but I can't figure out how to do that right now.
Comment 4 Will Thompson 2011-03-03 05:28:01 UTC
ARGAHAGHAGHAGHAGHAGH  RGAHGHAGHGHR GRAGHAGHAGHR

_end_element_ns:


  if (priv->node && priv->node->content)
    {
      /* Remove content if it's purely whitespace */
      const char *c;
      for (c = priv->node->content; *c != '\0' && g_ascii_isspace (*c); c++)
        ;
      if (*c == '\0')
        wocky_node_set_content (priv->node, NULL);
    }

RGHghghgh
Comment 5 Jonny Lamb 2011-03-22 08:17:07 UTC
+"  <message to='morse@met.police.uk' from='lewis@met.police.uk'> " \

I'm afraid Morse and Lewis were Oxfordshire police, and so weren't part of the Met. That should be thamesvalley.police.uk.

Looks good otherwise.
Comment 6 Will Thompson 2011-03-29 06:29:47 UTC
Merged with that heinous error corrected!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.