diff options
| author | Alexander Barton <alex@barton.de> | 2012-01-22 18:11:24 +0100 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2012-01-22 18:11:24 +0100 |
| commit | 6e28f4a7d13a81db99196da23958e81f2bb8418e (patch) | |
| tree | feb0ff15f04c1e60648cf9d165b4a1f8135074ae /src | |
| parent | 9882e578e9cbb9d86d235b45938fa57bf1e85e54 (diff) | |
| download | ngircd-6e28f4a7d13a81db99196da23958e81f2bb8418e.tar.gz ngircd-6e28f4a7d13a81db99196da23958e81f2bb8418e.zip | |
New function Lists_CheckReason() to get reason of list entries
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/lists.c | 19 | ||||
| -rw-r--r-- | src/ngircd/lists.h | 1 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/ngircd/lists.c b/src/ngircd/lists.c index c082f1c4..4f57ca73 100644 --- a/src/ngircd/lists.c +++ b/src/ngircd/lists.c @@ -320,7 +320,20 @@ Lists_MakeMask(const char *Pattern) * @return true if client is listed, false if not. */ bool -Lists_Check( struct list_head *h, CLIENT *Client) +Lists_Check(struct list_head *h, CLIENT *Client) +{ + return Lists_CheckReason(h, Client) != NULL; +} + +/** + * Check if a client is listed in a list and return the "reason". + * + * @param h List head. + * @param Client Client to check. + * @return true if client is listed, false if not. + */ +char * +Lists_CheckReason(struct list_head *h, CLIENT *Client) { struct list_elem *e, *last, *next; @@ -338,13 +351,13 @@ Lists_Check( struct list_head *h, CLIENT *Client) e->mask); Lists_Unlink(h, last, e); } - return true; + return e->reason ? e->reason : ""; } last = e; e = next; } - return false; + return NULL; } /** diff --git a/src/ngircd/lists.h b/src/ngircd/lists.h index cb2e2c1a..24504dfa 100644 --- a/src/ngircd/lists.h +++ b/src/ngircd/lists.h @@ -30,6 +30,7 @@ GLOBAL struct list_elem *Lists_GetFirst PARAMS((const struct list_head *)); GLOBAL struct list_elem *Lists_GetNext PARAMS((const struct list_elem *)); GLOBAL bool Lists_Check PARAMS((struct list_head *head, CLIENT *client)); +GLOBAL char *Lists_CheckReason PARAMS((struct list_head *head, CLIENT *client)); GLOBAL struct list_elem *Lists_CheckDupeMask PARAMS((const struct list_head *head, const char *mask)); |