SrainApp / srain

Modern IRC client written in GTK
https://srain.silverrainz.me/
Other
303 stars 34 forks source link

Parsing message tags #334

Closed progval closed 2 years ago

progval commented 3 years ago

Hi, I'd like to try adding support for message tags. They would have to be stored in SircMessage, and I can see four ways to do it:

  1. their own structure: typedef struct { char *key; char *value } SircMessageTag (with value NULLable if it's a tag with no value or an empty value) and SircMessage storing an array of those + a count
  2. storing an array of key + value pair, either NULL-terminated or with a count
  3. GHashTable
  4. adding an attribute to SircMessage for each tag name, populated directly by the parser; and discard unknown tags

Option 3 would probably be the most convenient, but it will be an issue if you want to add support for extensions/plugins/... in the future; as they can't use tags the parser isn't aware of.

Ditto for SircCommandBuilder.

What do you think?

(related issue: GH-75)

SilverRainZ commented 3 years ago

I prefer the 1st way, it also can work with 4st way: adding frequence uesed SircMessageTag to SircMessage for each tag name, for unknown tag, we adding it into an array.

SilverRainZ commented 2 years ago

I think this can be closed?

progval commented 2 years ago

Indeed!