presence: Add get_metadata().
This commit is contained in:
parent
0827f524e0
commit
85171f1f16
|
@ -614,6 +614,7 @@ extern char *generate_uid(void);
|
||||||
void allocate_away(struct Client *);
|
void allocate_away(struct Client *);
|
||||||
void free_away(struct Client *);
|
void free_away(struct Client *);
|
||||||
|
|
||||||
|
const char *get_metadata(struct Client *, const char *);
|
||||||
void set_metadata(struct Client *, const char *, const char *);
|
void set_metadata(struct Client *, const char *, const char *);
|
||||||
void delete_metadata(struct Client *, const char *);
|
void delete_metadata(struct Client *, const char *);
|
||||||
|
|
||||||
|
|
24
src/client.c
24
src/client.c
|
@ -1699,8 +1699,6 @@ make_server(struct Client *client_p)
|
||||||
void
|
void
|
||||||
free_user(struct User *user, struct Client *client_p)
|
free_user(struct User *user, struct Client *client_p)
|
||||||
{
|
{
|
||||||
free_away(client_p);
|
|
||||||
|
|
||||||
if(--user->refcnt <= 0)
|
if(--user->refcnt <= 0)
|
||||||
{
|
{
|
||||||
if(user->away)
|
if(user->away)
|
||||||
|
@ -1731,21 +1729,21 @@ free_user(struct User *user, struct Client *client_p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
const char *
|
||||||
allocate_away(struct Client *client_p)
|
get_metadata(struct Client *client_p, const char *key)
|
||||||
{
|
{
|
||||||
if(client_p->user->away == NULL)
|
struct MetadataEntry *md;
|
||||||
client_p->user->away = rb_bh_alloc(away_heap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (client_p->user != NULL)
|
||||||
|
{
|
||||||
|
md = irc_dictionary_retrieve(client_p->user->metadata, key);
|
||||||
|
if (md == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
void
|
return md->value;
|
||||||
free_away(struct Client *client_p)
|
|
||||||
{
|
|
||||||
if(client_p->user != NULL && client_p->user->away != NULL) {
|
|
||||||
rb_bh_free(away_heap, client_p->user->away);
|
|
||||||
client_p->user->away = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue