Add *_metadata_clear and start using them.
This commit is contained in:
parent
104becbf7f
commit
8bced6dc39
|
@ -313,6 +313,7 @@ extern struct Metadata *channel_metadata_add(struct Channel *target, const char
|
||||||
extern struct Metadata *channel_metadata_time_add(struct Channel *target, const char *name, time_t value);
|
extern struct Metadata *channel_metadata_time_add(struct Channel *target, const char *name, time_t value);
|
||||||
extern void channel_metadata_delete(struct Channel *target, const char *name, int propegate);
|
extern void channel_metadata_delete(struct Channel *target, const char *name, int propegate);
|
||||||
extern struct Metadata *channel_metadata_find(struct Channel *target, const char *name);
|
extern struct Metadata *channel_metadata_find(struct Channel *target, const char *name);
|
||||||
|
extern void channel_metadata_clear(struct Channel *target);
|
||||||
|
|
||||||
|
|
||||||
#endif /* INCLUDED_channel_h */
|
#endif /* INCLUDED_channel_h */
|
||||||
|
|
|
@ -624,5 +624,6 @@ void free_away(struct Client *);
|
||||||
extern struct Metadata *user_metadata_add(struct Client *target, const char *name, const char *value, int propegate);
|
extern struct Metadata *user_metadata_add(struct Client *target, const char *name, const char *value, int propegate);
|
||||||
extern void user_metadata_delete(struct Client *target, const char *name, int propegate);
|
extern void user_metadata_delete(struct Client *target, const char *name, int propegate);
|
||||||
extern struct Metadata *user_metadata_find(struct Client *target, const char *name);
|
extern struct Metadata *user_metadata_find(struct Client *target, const char *name);
|
||||||
|
extern void user_metadata_clear(struct Client *target);
|
||||||
|
|
||||||
#endif /* INCLUDED_client_h */
|
#endif /* INCLUDED_client_h */
|
||||||
|
|
|
@ -105,7 +105,7 @@ allocate_channel(const char *chname)
|
||||||
void
|
void
|
||||||
free_channel(struct Channel *chptr)
|
free_channel(struct Channel *chptr)
|
||||||
{
|
{
|
||||||
channel_metadata_delete(chptr, "NOREPEAT", 0);
|
channel_metadata_clear(chptr);
|
||||||
rb_free(chptr->chname);
|
rb_free(chptr->chname);
|
||||||
rb_bh_free(channel_heap, chptr);
|
rb_bh_free(channel_heap, chptr);
|
||||||
}
|
}
|
||||||
|
@ -2016,3 +2016,22 @@ channel_metadata_find(struct Channel *target, const char *name)
|
||||||
|
|
||||||
return irc_dictionary_retrieve(target->c_metadata, name);
|
return irc_dictionary_retrieve(target->c_metadata, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* channel_metadata_clear
|
||||||
|
*
|
||||||
|
* inputs - pointer to channel struct
|
||||||
|
* output - none
|
||||||
|
* side effects - metadata is cleared from the channel in question
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
channel_metadata_clear(struct Channel *chptr)
|
||||||
|
{
|
||||||
|
struct Metadata *md;
|
||||||
|
struct DictionaryIter iter;
|
||||||
|
|
||||||
|
DICTIONARY_FOREACH(md, &iter, chptr->c_metadata)
|
||||||
|
{
|
||||||
|
channel_metadata_delete(chptr, md->name, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
25
src/client.c
25
src/client.c
|
@ -1710,12 +1710,7 @@ free_user(struct User *user, struct Client *client_p)
|
||||||
free_away(client_p);
|
free_away(client_p);
|
||||||
|
|
||||||
/* get rid of any metadata the user may have */
|
/* get rid of any metadata the user may have */
|
||||||
if(IsOper(client_p))
|
user_metadata_clear(client_p);
|
||||||
{
|
|
||||||
user_metadata_delete(client_p, "swhois", 0);
|
|
||||||
user_metadata_delete(client_p, "operstring", 0);
|
|
||||||
}
|
|
||||||
user_metadata_delete(client_p, "OACCEPT", 0);
|
|
||||||
|
|
||||||
if(--user->refcnt <= 0)
|
if(--user->refcnt <= 0)
|
||||||
{
|
{
|
||||||
|
@ -2015,3 +2010,21 @@ user_metadata_find(struct Client *target, const char *name)
|
||||||
|
|
||||||
return irc_dictionary_retrieve(target->user->metadata, name);
|
return irc_dictionary_retrieve(target->user->metadata, name);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* user_metadata_clear
|
||||||
|
*
|
||||||
|
* inputs - pointer to user struct
|
||||||
|
* output - none
|
||||||
|
* side effects - metadata is cleared from the user in question
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
user_metadata_clear(struct Client *target)
|
||||||
|
{
|
||||||
|
struct Metadata *md;
|
||||||
|
struct DictionaryIter iter;
|
||||||
|
|
||||||
|
DICTIONARY_FOREACH(md, &iter, target->user->metadata)
|
||||||
|
{
|
||||||
|
user_metadata_delete(target, md->name, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -591,7 +591,7 @@ burst_TS6(struct Client *client_p)
|
||||||
{
|
{
|
||||||
/* don't bother bursting +J metadata */
|
/* don't bother bursting +J metadata */
|
||||||
if(!(md->name[0] == 'K'))
|
if(!(md->name[0] == 'K'))
|
||||||
sendto_one(client_p, ":%s ENCAP * METADATA ADD %s %s :%s",
|
sendto_one(&me, ":%s ENCAP * METADATA ADD %s %s :%s",
|
||||||
use_id(target_p), use_id(target_p), md->name, md->value);
|
use_id(target_p), use_id(target_p), md->name, md->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue