]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/numeric.c
Synchronize G-Lines on server login
[ngircd-alex.git] / src / ngircd / numeric.c
index 74c5c12bebc44f6056ba2dc0f04856cda3deb242..0440768c6151ccab7a5d8e3d043c2056e1b6d321 100644 (file)
@@ -7,12 +7,15 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
- *
- * Handlers for IRC numerics sent to the server
  */
 
 #include "portab.h"
 
+/**
+ * @file
+ * Handlers for IRC numerics sent to the server
+ */
+
 #include "imp.h"
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
 
 #include "defines.h"
-#include "resolve.h"
 #include "conn.h"
 #include "conf.h"
 #include "conn.h"
 #include "conn-func.h"
-#include "client.h"
 #include "channel.h"
+#include "class.h"
 #include "irc-write.h"
 #include "lists.h"
 #include "log.h"
@@ -131,7 +133,7 @@ Announce_Server(CLIENT * Client, CLIENT * Server)
        if (Client_Hops(Server) == 1)
                c = Client_ThisServer();
        else
-               c = Client_Introducer(Server);
+               c = Client_TopServer(Server);
 
        /* Inform new server about the one already registered in the network */
        return IRC_WriteStrClientPrefix(Client, c, "SERVER %s %d %d :%s",
@@ -193,8 +195,10 @@ Announce_User(CLIENT * Client, CLIENT * User)
 #ifdef IRCPLUS
 
 /**
- * Synchronize invite and ban lists between servers
- * @param Client New server
+ * Synchronize invite, ban, G- and K-Line lists between servers.
+ *
+ * @param Client New server.
+ * @return CONNECTED or DISCONNECTED.
  */
 static bool
 Synchronize_Lists(CLIENT * Client)
@@ -205,6 +209,18 @@ Synchronize_Lists(CLIENT * Client)
 
        assert(Client != NULL);
 
+       /* g-lines */
+       head = Class_GetList(CLASS_GLINE);
+       elem = Lists_GetFirst(head);
+       while (elem) {
+               if (!IRC_WriteStrClient(Client, "GLINE %s %ld :%s",
+                                       Lists_GetMask(elem),
+                                       Lists_GetValidity(elem) - time(NULL),
+                                       Lists_GetReason(elem)))
+                       return DISCONNECTED;
+               elem = Lists_GetNext(elem);
+       }
+
        c = Channel_First();
        while (c) {
                /* ban list */