]> jfr.im git - irc/quakenet/newserv.git/blobdiff - helpmod2/haccount.c
nickwatch: Implement hook for messages/notices.
[irc/quakenet/newserv.git] / helpmod2 / haccount.c
index 5ce4e5537762fd527b3fe064e66c692d316714fc..974c366cc3793995471a9dbdbe7f3680b653f6e2 100644 (file)
@@ -31,7 +31,7 @@ haccount *haccount_get_by_name(const char *name)
 
 haccount *haccount_add(const char *name, hlevel lvl)
 {
-    haccount *tmp = (haccount*)malloc(sizeof (haccount));
+    haccount *tmp;
 
     if (haccount_get_by_name(name))
     {
@@ -42,6 +42,7 @@ haccount *haccount_add(const char *name, hlevel lvl)
     if (*name == '#')
         name++;
 
+    tmp = (haccount*)malloc(sizeof (haccount));
     tmp->name = getsstring(name, strlen(name));
     tmp->level = lvl;
     tmp->flags = H_ACCFLAGS_DEFAULT;
@@ -90,9 +91,9 @@ void haccount_clear_inactives(void)
 {
     haccount **ptr = &haccounts;
     while (*ptr)
-        if (time(NULL) - (*ptr)->last_activity > HELPMOD_ACCOUNT_EXPIRATION[(*ptr)->level])
-            haccount_del(*ptr);
-        else
+       if ((time(NULL) - (*ptr)->last_activity > HELPMOD_ACCOUNT_EXPIRATION[(*ptr)->level]) && !((*ptr)->flags & H_NO_EXPIRE))
+           haccount_del(*ptr);
+       else
             ptr = &(*ptr)->next;
 }