summary refs log tree commit diff
path: root/src/ngircd/irc-server.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2006-12-07 17:57:20 +0000
committerFlorian Westphal <fw@strlen.de>2006-12-07 17:57:20 +0000
commitfa7bb2790a1588e49d05cf3404220c3a63669514 (patch)
tree4531db6abfa80e26ed92c632e3ac14ae9cac6560 /src/ngircd/irc-server.c
parent5877bca4bcea97d50c6c2997ac2914d78552c6a6 (diff)
downloadngircd-fa7bb2790a1588e49d05cf3404220c3a63669514.tar.gz
ngircd-fa7bb2790a1588e49d05cf3404220c3a63669514.zip
moved invite/ban lists to channel structure
Diffstat (limited to 'src/ngircd/irc-server.c')
-rw-r--r--src/ngircd/irc-server.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/src/ngircd/irc-server.c b/src/ngircd/irc-server.c
index c58e7dcb..da9ba978 100644
--- a/src/ngircd/irc-server.c
+++ b/src/ngircd/irc-server.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-server.c,v 1.42 2006/12/02 14:10:48 fw Exp $";
+static char UNUSED id[] = "$Id: irc-server.c,v 1.43 2006/12/07 17:57:20 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -41,6 +41,50 @@ static char UNUSED id[] = "$Id: irc-server.c,v 1.42 2006/12/02 14:10:48 fw Exp $
 #include "irc-server.h"
 
 
+#ifdef IRCPLUS
+static bool
+Synchronize_Lists( CLIENT *Client )
+{
+	CHANNEL *c;
+	struct list_head *head;
+	struct list_elem *elem;
+
+	assert( Client != NULL );
+
+	c = Channel_First();
+
+	while (c) {
+		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 false;
+			}
+			elem = Lists_GetNext(elem);
+		}
+
+		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 false;
+			}
+			elem = Lists_GetNext(elem);
+		}
+		c = Channel_Next(c);
+	}
+	return true;
+}
+#endif
+
+
+
+
 /**
  * Handler for the IRC command "SERVER".
  * See RFC 2813 section 4.1.2.
@@ -268,9 +312,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
 			    "Synchronizing INVITE- and BAN-lists ...");
 #endif
 			/* Synchronize INVITE- and BAN-lists */
-			if (! Lists_SendInvites(Client))
-				return DISCONNECTED;
-			if (! Lists_SendBans(Client))
+			if (!Synchronize_Lists(Client))
 				return DISCONNECTED;
 		}
 #endif