X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fnumeric.c;h=b0ceeef815e3d4cf91a8501801f36e983121e208;hp=e1b160b374554b91c80d967f92b89d0f198bc88b;hb=84ff5a6eb975fbabfaaa92447246571721a016bc;hpb=259c314d142abd6f9295047c116235cfdd119563 diff --git a/src/ngircd/numeric.c b/src/ngircd/numeric.c index e1b160b3..b0ceeef8 100644 --- a/src/ngircd/numeric.c +++ b/src/ngircd/numeric.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2008 Alexander Barton (alex@barton.de) + * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,18 +20,15 @@ #include #include #include +#include -#include "defines.h" -#include "conn.h" -#include "conf.h" -#include "conn.h" #include "conn-func.h" +#include "conf.h" #include "channel.h" #include "class.h" #include "irc-write.h" #include "lists.h" #include "log.h" -#include "messages.h" #include "parse.h" #include "numeric.h" @@ -148,7 +145,27 @@ Announce_Server(CLIENT * Client, CLIENT * Server) #ifdef IRCPLUS /** - * Synchronize invite, ban, G- and K-Line lists between servers. + * Send a specific list to a remote server. + */ +static bool +Send_List(CLIENT *Client, CHANNEL *Chan, struct list_head *Head, char Type) +{ + struct list_elem *elem; + + elem = Lists_GetFirst(Head); + while (elem) { + if (!IRC_WriteStrClient(Client, "MODE %s +%c %s", + Channel_Name(Chan), Type, + Lists_GetMask(elem))) { + return DISCONNECTED; + } + elem = Lists_GetNext(elem); + } + return CONNECTED; +} + +/** + * Synchronize invite, ban, except, and G-Line lists between servers. * * @param Client New server. * @return CONNECTED or DISCONNECTED. @@ -176,30 +193,12 @@ Synchronize_Lists(CLIENT * Client) c = Channel_First(); while (c) { - /* ban list */ - head = Channel_GetListBans(c); - elem = Lists_GetFirst(head); - while (elem) { - if (!IRC_WriteStrClient(Client, "MODE %s +b %s", - Channel_Name(c), - Lists_GetMask(elem))) { - return DISCONNECTED; - } - elem = Lists_GetNext(elem); - } - - /* invite list */ - head = Channel_GetListInvites(c); - elem = Lists_GetFirst(head); - while (elem) { - if (!IRC_WriteStrClient(Client, "MODE %s +I %s", - Channel_Name(c), - Lists_GetMask(elem))) { - return DISCONNECTED; - } - elem = Lists_GetNext(elem); - } - + if (!Send_List(Client, c, Channel_GetListExcepts(c), 'e')) + return DISCONNECTED; + if (!Send_List(Client, c, Channel_GetListBans(c), 'b')) + return DISCONNECTED; + if (!Send_List(Client, c, Channel_GetListInvites(c), 'I')) + return DISCONNECTED; c = Channel_Next(c); } return CONNECTED;