]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/lists.c
Don't enforce MAX_HNDL_MODES_ARG on server and service links
[ngircd-alex.git] / src / ngircd / lists.c
index 11f8e888fec5292ff9b169c2fa9cd4954b2fc413..fd86f3017efabea10175054619177b982f2a4670 100644 (file)
@@ -60,13 +60,13 @@ Lists_GetMask(const struct list_elem *e)
  * Get optional "reason" text stored in list element.
  *
  * @param list_elem List element.
- * @return Pointer to "reason" text or NULL.
+ * @return Pointer to "reason" text or empty string ("").
  */
 GLOBAL const char *
 Lists_GetReason(const struct list_elem *e)
 {
        assert(e != NULL);
-       return e->reason;
+       return e->reason ? e->reason : "";
 }
 
 /**
@@ -126,8 +126,15 @@ Lists_Add(struct list_head *h, const char *Mask, time_t ValidUntil,
        assert(h != NULL);
        assert(Mask != NULL);
 
-       if (Lists_CheckDupeMask(h, Mask))
+       e = Lists_CheckDupeMask(h, Mask);
+       if (e) {
+               e->valid_until = ValidUntil;
+               if (Reason) {
+                       free(e->reason);
+                       e->reason = strdup(Reason);
+               }
                return true;
+       }
 
        e = Lists_GetFirst(h);
 
@@ -316,13 +323,11 @@ bool
 Lists_Check( struct list_head *h, CLIENT *Client)
 {
        struct list_elem *e, *last, *next;
-       time_t now;
 
        assert(h != NULL);
 
        e = h->first;
        last = NULL;
-       now = time(NULL);
 
        while (e) {
                next = e->next;