]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Merge.
authorChris Porter <redacted>
Mon, 18 Aug 2008 20:02:57 +0000 (21:02 +0100)
committerChris Porter <redacted>
Mon, 18 Aug 2008 20:02:57 +0000 (21:02 +0100)
authext/authext.c
authext/authext.h
chanserv/database/chanservdb.c
core/hooks.h

index 2451a6227bfddc4675ae88a890ea5bf0ee29764c..0b395d764394b778106d678c99233856c4f2d0d1 100644 (file)
@@ -21,7 +21,10 @@ authname *authnametable[AUTHNAMEHASHSIZE];
 /* internal access only */
 static authname *authnametablebyname[AUTHNAMEHASHSIZE];
 
-sstring *authnameextnames[MAXAUTHNAMEEXTS];
+static struct {
+  sstring *name;
+  int persistant;
+} authnameexts[MAXAUTHNAMEEXTS];
 
 static void authextstats(int hooknum, void *arg);
 
@@ -60,7 +63,7 @@ void freeauthname (authname *anp) {
   freeauthnames=anp;
 }
 
-int registerauthnameext(const char *name) {
+int registerauthnameext(const char *name, int persistant) {
   int i;
 
   if (findauthnameext(name)!=-1) {
@@ -69,8 +72,9 @@ int registerauthnameext(const char *name) {
   }
 
   for (i=0;i<MAXAUTHNAMEEXTS;i++) {
-    if (authnameextnames[i]==NULL) {
-      authnameextnames[i]=getsstring(name,100);
+    if (authnameexts[i].name==NULL) {
+      authnameexts[i].name=getsstring(name,100);
+      authnameexts[i].persistant=persistant;
       return i;
     }
   }
@@ -83,7 +87,7 @@ int findauthnameext(const char *name) {
   int i;
 
   for (i=0;i<MAXAUTHNAMEEXTS;i++) {
-    if (authnameextnames[i]!=NULL && !ircd_strcmp(name,authnameextnames[i]->content)) {
+    if (authnameexts[i].name!=NULL && !ircd_strcmp(name,authnameexts[i].name->content)) {
       return i;
     }
   }
@@ -95,8 +99,8 @@ void releaseauthnameext(int index) {
   int i;
   authname *anp;
 
-  freesstring(authnameextnames[index]);
-  authnameextnames[index]=NULL;
+  freesstring(authnameexts[index].name);
+  authnameexts[index].name=NULL;
 
   for (i=0;i<AUTHNAMEHASHSIZE;i++) {
     for (anp=authnametable[i];anp;anp=anp->next) {
@@ -169,9 +173,10 @@ void releaseauthname(authname *anp) {
     anp->nicks = NULL;
 
     for(i=0;i<MAXAUTHNAMEEXTS;i++)
-      if(anp->exts[i]!=NULL)
+      if(authnameexts[i].persistant && anp->exts[i]!=NULL)
         return;
 
+    triggerhook(HOOK_AUTH_LOSTAUTHNAME, (void *)anp);
     found = 0;
     for(manp=&(authnametable[authnamehash(anp->userid)]);*manp;manp=(authname **)&((*manp)->next)) {
       if ((*manp)==anp) {
index 5a0ed6a784eb682d0fe666c0783151973720c0fc..4a78c2f0f4d5bc10aee4f80c561208e215cbaadb 100644 (file)
@@ -36,7 +36,7 @@ authname *newauthname(void);
 void freeauthname (authname *hp);
 
 /* EXT management */
-int registerauthnameext(const char *name);
+int registerauthnameext(const char *name, int persistant);
 int findauthnameext(const char *name);
 void releaseauthnameext(int index);
 
index df83df675e09018f8553c18b419e5eb87aa44167..cb28b286c1b4e2132aff974a142ca32c03f7d1e2 100644 (file)
@@ -230,7 +230,7 @@ static void setuptables() {
 
 void _init() {
   chanservext=registerchanext("chanserv");
-  chanservaext=registerauthnameext("chanserv");
+  chanservaext=registerauthnameext("chanserv",1);
 
   /* Set up the allocators and hashes */
   chanservallocinit();
index 34171fc95a8f0c57b34b94de94e73ae58c05b81b..0ac9c1614f2fc99b3ef5f537994a7be0f9118047 100644 (file)
@@ -70,6 +70,7 @@
 #define HOOK_SHADOW_SERVER         701 /* Argument is char* */
 
 #define HOOK_AUTH_FLAGSUPDATED     801 /* Argument is void*[2] (authname*, u_int64_t*) */
+#define HOOK_AUTH_LOSTAUTHNAME     802 /* Argument is authname* */
 
 typedef void (*HookCallback)(int, void *);