]> jfr.im git - irc/quakenet/newserv.git/blobdiff - jupe/jupe.c
Merge pull request #1 from meeb/meeb
[irc/quakenet/newserv.git] / jupe / jupe.c
index 122c5cf1e6b309225e6d9bfac175f7aa385b40de..7339dd2a5ea54cb0914b2a66c1df2e6adff9e443 100644 (file)
 jupe_t *jupes = NULL;
 
 int handlejupe(void *source, int cargc, char **cargv);
-void sendjupeburst(int hook, void *args);
 
 void _init() {
-  registerhook(HOOK_IRC_SENDBURSTBURSTS, &sendjupeburst);
-       
-  registerserverhandler("JU", &handlejupe, 5);
+  /* If we're connected to IRC, force a disconnect. */
+  if (connected) {
+    irc_send("%s SQ %s 0 :Resync [adding jupe support]", mynumeric->content, myserver->content);
+    irc_disconnected(0);
+  }
 
-  irc_send("%s RB J", mynumeric->content);
+  registerserverhandler("JU", &handlejupe, 5);
 }
 
 void _fini() {
@@ -35,8 +36,6 @@ void _fini() {
     jupes = next;
   }
 
-  deregisterhook(HOOK_IRC_SENDBURSTBURSTS, &sendjupeburst);
-       
   deregisterserverhandler("JU", &handlejupe);
 }
 
@@ -69,7 +68,7 @@ int handlejupe(void *source, int cargc, char **cargv) {
     jupe->ju_flags = flags;
     jupe->ju_lastmod = atoi(modtime);
 
-    Error("jupe", ERR_WARNING, "jupe modified for %s (%s) expiring in %s,"
+    Error("jupe", ERR_INFO, "jupe modified for %s (%s) expiring in %s,"
                                " lastmod: %s, active: %s", server, reason, expire, modtime, flags ? "yes" : "no");
     return CMD_OK;
   }
@@ -79,25 +78,12 @@ int handlejupe(void *source, int cargc, char **cargv) {
   if (jupe == NULL)
     return CMD_ERROR;
 
-  Error("jupe", ERR_WARNING, "jupe added for %s (%s) expiring in %s,"
+  Error("jupe", ERR_INFO, "jupe added for %s (%s) expiring in %s,"
                " lastmod: %s, active: %s", server, reason, expire, modtime, flags ? "yes" : "no");
 
   return CMD_OK;
 }
 
-void sendjupeburst(int hook, void *args) {
-  jupe_t *jupe = jupes;
-
-  if (hook != HOOK_IRC_SENDBURSTBURSTS)
-    return;
-
-  while (jupe) {
-    jupe_propagate(jupe);
-
-    jupe = jupe->ju_next;
-  }
-}
-
 jupe_t *make_jupe(char *server, char *reason, time_t expirets, time_t lastmod, unsigned int flags) {
   jupe_t *jupe;
 
@@ -204,7 +190,7 @@ int jupe_add(char *server, char *reason, time_t duration, unsigned int flags) {
     return 0;
 
   jupe = make_jupe(server, reason, getnettime() + duration, getnettime(), flags);
-       
+
   if (jupe == NULL)
     return 0;