chandler icon indicating copy to clipboard operation
chandler copied to clipboard

Distinguish name and id for contact information

Open phorcys420 opened this issue 1 year ago • 4 comments

If I take the example of Discord, I'd rather be able to have a label that says "user#0000", or "Discord" than a raw ID like that.

image

what I'm thinking about is that when creating the contact information type, you could specify whether you should distinguish ID and name or not. (and if #458 gets implemented, then two separate values should be available too)

phorcys420 avatar Mar 27 '23 19:03 phorcys420

I want to add that this'd be nice to have if monica plugins ever become a thing (or already are).

That way we could write plugins that would automatically integrate remote platforms with monica.

phorcys420 avatar Apr 21 '23 17:04 phorcys420

I want to add that this'd be nice to have if monica plugins ever become a thing (or already are).

I would love that. That being said, I have no idea how to achieve this. Do you know any kind of documentation I could read that would guide us towards this approach?

djaiss avatar Apr 26 '23 20:04 djaiss

I would love that. That being said, I have no idea how to achieve this. Do you know any kind of documentation I could read that would guide us towards this approach?

I'm more of a JS guy -- but generally speaking you'd source other PHP files from another directory. In that plugin's directory, you usually have :

  • a config file
  • a dependencies file (in this case I assume it'd be a composer.json file)
  • a php file that exposes an init and other functions (usually related to hooks)
  • for efficiency you expose hooks for specific actions, that way the plugin only gets poked when needed.

Roundcube does it pretty well and uses composer for fetching the plugins but I'm unsure how they go about the whole hooks and API things since I've only ever done that type of stuff in JS. https://github.com/roundcube/roundcubemail/wiki/Plugin-API

It seems that they do the loading by using an array in the config and (speculation) looping over it to source the proper files.

I havent found any good docs on php module systems, but I think roundcube's way of approaching it is the way to go.

I would start this out with basic plugin loading and exposing a high-level API for plugins to use (create user, edit user, etc) rather than immediately trying to implement hooks, since that's going to take a bit more time and the plugin system should be polished before.

I hope this helps.

phorcys420 avatar Apr 27 '23 06:04 phorcys420

@phorcys420 this is extremely instructive. Thanks a lot.

djaiss avatar May 05 '23 19:05 djaiss