]> jfr.im git - irc/quakenet/newserv.git/blobdiff - helpmod2/haccount.c
CHANSERV: remove E type escapes
[irc/quakenet/newserv.git] / helpmod2 / haccount.c
index 3bb649e3ffb83f2f88782bf1659c61705acbf455..974c366cc3793995471a9dbdbe7f3680b653f6e2 100644 (file)
@@ -31,11 +31,18 @@ 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))
+    {
+       Error("helpmod", ERR_ERROR, "Attempt to add a duplicate account: %s", name);
+       return haccount_get_by_name(name);
+    }
 
     if (*name == '#')
         name++;
 
+    tmp = (haccount*)malloc(sizeof (haccount));
     tmp->name = getsstring(name, strlen(name));
     tmp->level = lvl;
     tmp->flags = H_ACCFLAGS_DEFAULT;
@@ -84,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;
 }
 
@@ -100,9 +107,9 @@ void haccount_set_level(haccount *hack, hlevel lvl)
 const char *haccount_get_state(haccount* hacc, int mask)
 {
     if (hacc->flags & mask)
-        return "On";
+        return "Yes";
     else
-        return "Off";
+        return "No";
 }
 
 int haccount_count(hlevel lvl)
@@ -134,6 +141,6 @@ const char *haccount_get_sname(int index)
     case 5:
         return "Suppress unknown command error";
     default:
-        return "error. Please contact strutsi";
+        return "Error. Please contact strutsi";
     }
 }