diff options
| author | Alexander Barton <alex@barton.de> | 2014-09-18 01:08:55 +0200 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2014-09-22 02:17:04 +0200 |
| commit | 84ff5a6eb975fbabfaaa92447246571721a016bc (patch) | |
| tree | 91ee7468214587d37faaf0ee13ee6cd887e79af2 /src | |
| parent | bf2eae3249cd7890c0189dfcf1a50b0e40e199b2 (diff) | |
| download | ngircd-84ff5a6eb975fbabfaaa92447246571721a016bc.tar.gz ngircd-84ff5a6eb975fbabfaaa92447246571721a016bc.zip | |
Sync "except lists" between servers
Up to now, ban, invite, and G-Line lists have been synced between servers while linking -- but obviously nobody noticed that except list have been missing ever since. Until now. Thanks to "j4jackj", who reported this issue in #ngircd.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/numeric.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/src/ngircd/numeric.c b/src/ngircd/numeric.c index da863e4d..b0ceeef8 100644 --- a/src/ngircd/numeric.c +++ b/src/ngircd/numeric.c @@ -145,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. @@ -173,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; |