/*
* 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
* Handlers for IRC numerics sent to the server
*/
-#include "imp.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
-#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 "exp.h"
#include "numeric.h"
-
/**
* Announce a channel and its users in the network.
*/
return CONNECTED;
} /* Announce_Channel */
-
/**
* Announce new server in the network
* @param Client New server
Client_MyToken(Server), Client_Info(Server));
} /* Announce_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.
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;
}
-
/**
* Send CHANINFO commands to a new server (inform it about existing channels).
* @param Client New server
bool has_k, has_l;
#ifdef DEBUG
- Log(LOG_DEBUG, "Sending CHANINFO commands ...");
+ Log(LOG_DEBUG, "Sending CHANINFO commands for \"%s\" ...",
+ Channel_Name(Chan));
#endif
modes = Channel_Modes(Chan);
#endif /* IRCPLUS */
-
/**
* Handle ENDOFMOTD (376) numeric and login remote server.
* The peer is either an IRC server (no IRC+ protocol), or we got the
return CONNECTED;
} /* IRC_Num_ENDOFMOTD */
-
/**
* Handle ISUPPORT (005) numeric.
*/
return CONNECTED;
} /* IRC_Num_ISUPPORT */
-
/* -eof- */