Skip to content

Refactor URI parsing/unescaping and linkification

mjk requested to merge mjk/gajim:fix-uri-unescaping into master

...as well as escaping in some places.

User-facing effects are minor:

  • Less invalid/useless things linkified in chats and vcards.
  • Tricky JIDs, e.g. those of Biboumi/Bifröst rooms, properly unescaped when clicked or pasted into the join-chat dialog.
  • More useful behavior in handling some corner-case links, e.g. geo with altitude or xmpp links that Gajim doesn't (yet) know how to handle, like xmpp:a@b?subscribe.

Most changes, though, are for:

  • code quality (deduplication, separation of concerns, standard terminology, ...),
  • groundwork for scheme-specific context menus and tooltips (a yet to be proposed MR), and
  • some more test cases added.

parse_uri only parses (absolute) URIs now:

  • No scheme-less assumed-http foos (again, URI formatting moved out).
  • No JID-like things. In most cases I made sure emails/JIDs are formatted as mailto/xmpp URIs before they get into parse_uri. Other, rarer cases experienced a regression and need some (later) work, e.g. non-URI strings from server contact addresses producing blue, but unclickable text (either no linkification should be done of such strings, or their JIDness assessed).

This should be reviewable commit by commit and, hopefully, mergeable without squashing. :P I did it in less that 10 commits, too!

Merge request reports