#include "portab.h"
-static char UNUSED id[] = "$Id: irc-server.c,v 1.40 2006/10/01 19:05:02 alex 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>
#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.
if (Client_Type(Client) == CLIENT_GOTPASS) {
/* We got a PASS command from the peer, and now a SERVER
* command: the peer tries to register itself as a server. */
- Log(LOG_DEBUG,
- "Connection %d: got SERVER command (new server link) ...",
- Client_Conn(Client));
+ LogDebug("Connection %d: got SERVER command (new server link) ...",
+ Client_Conn(Client));
/* Falsche Anzahl Parameter? */
if(( Req->argc != 2 ) && ( Req->argc != 3 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
else
{
/* "CHANINFO <chan> +<modes> <key> <limit> :<topic>" */
- if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s %s %ld :%s", Channel_Name( chan ), modes, strchr( Channel_Modes( chan ), 'k' ) ? Channel_Key( chan ) : "*", strchr( Channel_Modes( chan ), 'l' ) ? Channel_MaxUsers( chan ) : 0L, topic )) return DISCONNECTED;
+ if( ! IRC_WriteStrClient( Client, "CHANINFO %s +%s %s %lu :%s",
+ Channel_Name( chan ), modes,
+ strchr( Channel_Modes( chan ), 'k' ) ? Channel_Key( chan ) : "*",
+ strchr( Channel_Modes( chan ), 'l' ) ? Channel_MaxUsers( chan ) : 0UL, topic ))
+ {
+ return DISCONNECTED;
+ }
}
}
}
"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