]> jfr.im git - irc/quakenet/newserv.git/blobdiff - trusts/data.c
LUA: add kill queue
[irc/quakenet/newserv.git] / trusts / data.c
index 5c30046b262616114047a62a5cb4da4f7ac7d26c..f4c49a6a316894c446bf18f29ab9861b91882c9e 100644 (file)
@@ -121,7 +121,7 @@ trustgroup *tg_add(trustgroup *itg) {
   memcpy(tg, itg, sizeof(trustgroup));
 
   tg->name = getsstring(tg->name->content, TRUSTNAMELEN);
-  tg->createdby = getsstring(tg->createdby->content, NICKLEN);
+  tg->createdby = getsstring(tg->createdby->content, CREATEDBYLEN);
   tg->contact = getsstring(tg->contact->content, CONTACTLEN);
   tg->comment = getsstring(tg->comment->content, COMMENTLEN);
   if(!tg->name || !tg->createdby || !tg->contact || !tg->comment) {
@@ -273,26 +273,16 @@ trustgroup *tg_strtotg(char *name) {
 
   /* legacy format */
   if(name[0] == '#') {
-    id = strtoul(&name[1], NULL, 10);
-    if(!id)
+    char *endp;
+    id = strtoul(&name[1], &endp, 10);
+    if(!id || *endp)
       return NULL;
 
-    for(tg=tglist;tg;tg=tg->next)
-      if(tg->id == id)
-        return tg;
+    return tg_getbyid(id);
   }
 
   for(tg=tglist;tg;tg=tg->next)
-    if(!match(name, tg->name->content))
-      return tg;
-
-  id = strtoul(name, NULL, 10);
-  if(!id)
-    return NULL;
-
-  /* legacy format */
-  for(tg=tglist;tg;tg=tg->next)
-    if(tg->id == id)
+    if(!strcmp(name, tg->name->content))
       return tg;
 
   return NULL;
@@ -436,10 +426,10 @@ int tg_modify(trustgroup *oldtg, trustgroup *newtg) {
   /* unfortunately we can't just memcpy the new one over */
 
   vnewtg.name = getsstring(newtg->name->content, TRUSTNAMELEN);
-  vnewtg.createdby = getsstring(newtg->createdby->content, NICKLEN);
+  vnewtg.createdby = getsstring(newtg->createdby->content, CREATEDBYLEN);
   vnewtg.contact = getsstring(newtg->contact->content, CONTACTLEN);
   vnewtg.comment = getsstring(newtg->comment->content, COMMENTLEN);
-  if(!vnewtg.name || !vnewtg.createdby || !vnewtg.contact || vnewtg.comment) {
+  if(!vnewtg.name || !vnewtg.createdby || !vnewtg.contact || !vnewtg.comment) {
     freesstring(vnewtg.name);
     freesstring(vnewtg.createdby);
     freesstring(vnewtg.contact);
@@ -454,7 +444,7 @@ int tg_modify(trustgroup *oldtg, trustgroup *newtg) {
   vnewtg.maxusage = newtg->maxusage;
   vnewtg.expires = newtg->expires;
   vnewtg.lastseen = newtg->lastseen;
-  vnewtg.lastmaxuserreset = newtg->lastmaxuserreset;
+  vnewtg.lastmaxusereset = newtg->lastmaxusereset;
 
   memcpy(oldtg, &vnewtg, sizeof(trustgroup));