Project

General

Profile

Feature #19

Make stuff clickable in ChatWidget

Added by Sputnick over 13 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
-
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
OS:
Any

Description

Things that should be clickable:

  • URLs (via plugin?)
  • Nicks (how to recognize? Can we do this by plugin as well?)
  • Channels (easy, just check for #)

Additional information:

If we'd like to move stuff out into a plugin, we need to think about how to handle mouse clicks and provide appropriate context menus. Also, where would we put in %DU if needed? Nicks and channel names should not be visually modified, but we'll probably want to mark URLs with a special formatting.

The right stage for parsing for URLs and known nicks should be after passing the string through the style engine (which also means it's the last stage before displaying it, after going through all the plugins as well).

We might want to add a special plugin interface, which can provide an URL matcher plus handler and fitting context menus. Maybe the same even for nicks and channels. At least a plugin could provide additional context menu entries, such as using external tools for a nick or a nick's hostmask, or handle special URLs such as svn:// or whatever.

So for now, I'd suggest the following:
After creating and styling a message, we match for known nicks as well as for channel and URL patterns. This should be enough to set the appropriate range data in StringFormats, and to do underline-on-demand while drawing the chatline. We might use a plugin layer to add additional matches.

Whenever a link is clicked, we check our plugins for actions that they provide for the given type of link, either to show a context menu or to perform a default action.

History

#2 Updated by EgS about 12 years ago

  • Nicks (how to recognize? Can we do this by plugin as well?)

Lazy! My personal favourite when doing stuff. The only disadvantage is, that it there won't be visible feedback that this word is actually a klickable.

Sooo my proposed solution:
don't treat words (when rendering/layouting) differently if the represent a user, or even check for it. This would result in quite heavy work. (especially when putting into relation with the backlog (currently the core sends me 20k chatlines... you just don't want to check each and every word against a list of possible candidates)).

But when catching the mousevent it should be quite fast to check if the word below the mouse actually is a nickname of a user. It's basically a lookup for network()->ircUser(ircUserCandidate) (which is a lookup in a hash - YAY). And if we got a valid ircUser we can act accordingly.

#3 Updated by Sputnick about 12 years ago

Yeah, I think I'll do the whole regexp thing lazy as well. Probably even will make it visible anyway, if that's possible with the new chatwidget...

#4 Updated by Sputnick over 11 years ago

Links are clickable now (and even underlined on hover). Other stuff is recognized but not handled yet. Will come in due time, I guess. No need to keep this BR open though.

Also available in: Atom PDF