Add new constants for presence key/value lengths
instead of overloading NICKLEN/TOPICLEN.
This commit is contained in:
parent
084af78f05
commit
9d393c9052
|
@ -121,8 +121,8 @@ struct ZipStats
|
|||
|
||||
struct MetadataEntry
|
||||
{
|
||||
char key[NICKLEN+1];
|
||||
char value[TOPICLEN];
|
||||
char key[METADATAKEYLEN];
|
||||
char value[METADATAVALUELEN];
|
||||
};
|
||||
|
||||
struct Client
|
||||
|
|
|
@ -111,6 +111,13 @@
|
|||
#define BANREASONLEN 390 /* kline/dline */
|
||||
#define AWAYLEN TOPICLEN
|
||||
#define KILLLEN 200 /* with Killed (nick ()) added this should fit in quit */
|
||||
#define METADATAKEYLEN 31
|
||||
/* :012345678901234567890123456789012345678901234567890123456789123 792 * 012345678901234567890123456789 012345678901234567890123456789 :
|
||||
* takes at most 137 bytes
|
||||
* :123456789 ENCAP * PRESENCE 012345678901234567890123456789 :
|
||||
* takes at most 63 bytes
|
||||
* */
|
||||
#define METADATAVALUELEN 300
|
||||
|
||||
/* 23+1 for \0 */
|
||||
#define KEYLEN 24
|
||||
|
|
|
@ -1753,15 +1753,15 @@ set_metadata(struct Client *client_p, const char *key, const char *value)
|
|||
if (md == NULL)
|
||||
{
|
||||
md = rb_bh_alloc(metadata_heap);
|
||||
rb_strlcpy(md->key, key, NICKLEN);
|
||||
rb_strlcpy(md->key, key, sizeof md->key);
|
||||
irc_dictionary_add(client_p->user->metadata, md->key, md);
|
||||
}
|
||||
else if (!strcmp(md->key, key) && !strcmp(md->value, value))
|
||||
return;
|
||||
else
|
||||
rb_strlcpy(md->key, key, NICKLEN);
|
||||
rb_strlcpy(md->key, key, sizeof md->key);
|
||||
|
||||
rb_strlcpy(md->value, value, TOPICLEN);
|
||||
rb_strlcpy(md->value, value, sizeof md->value);
|
||||
}
|
||||
|
||||
sendto_common_channels_local_with_capability(client_p, CLICAP_PRESENCE, form_str(RPL_METADATACHG), me.name, client_p->name, key, value);
|
||||
|
|
Loading…
Reference in New Issue