commit - 7b69bc2ae80f43bb6ed823760c01132be83fa2b9
commit + 2cc21caf32323ebd778c16c8a7b69cd12d6ff01f
blob - 0f25a190470e51216e256b4caf2d9734a6b35a40
blob + 7c3360acb088ebf4690f5796fa5287226473a961
--- src/ngircd/channel.c
+++ src/ngircd/channel.c
if (strlen(Name) <= 1)
return false;
#endif
- if (strchr("+#", Name[0]) == NULL)
+ if (strchr("#&+", Name[0]) == NULL)
return false;
if (strlen(Name) >= CHANNEL_NAME_LEN)
return false;
assert( Client != NULL );
assert( Origin != NULL );
assert( Reason != NULL );
+
+ /* Do not inform other servers if the channel is local to this server,
+ * regardless of what the caller requested! */
+ if(InformServer)
+ InformServer = !Channel_IsLocal(Chan);
last_cl2chan = NULL;
cl2chan = My_Cl2Chan;
switch( Type )
{
case REMOVE_QUIT:
- /* QUIT: other servers have already been notified, see Client_Destroy();
- * so only inform other clients in same channel. */
+ /* QUIT: other servers have already been notified,
+ * see Client_Destroy(); so only inform other clients
+ * in same channel. */
assert( InformServer == false );
LogDebug("User \"%s\" left channel \"%s\" (%s).",
Client_Mask( Client ), c->name, Reason );
break;
case REMOVE_KICK:
- /* User was KICKed: inform other servers and all users in channel */
+ /* User was KICKed: inform other servers (public
+ * channels) and all users in the channel */
if( InformServer )
IRC_WriteStrServersPrefix( Client_NextHop( Origin ),
Origin, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason);
return true;
} /* Delete_Channel */
-
/* -eof- */
blob - 792f26928996c641f29f8688553f90c01d8e7e51
blob + 91cc278e2ffe773609fcc30ca6787ba5f6db6a8e
--- src/ngircd/channel.h
+++ src/ngircd/channel.h
GLOBAL bool Channel_ShowBans PARAMS((CLIENT *client, CHANNEL *c));
GLOBAL bool Channel_ShowInvites PARAMS((CLIENT *client, CHANNEL *c));
+
+#define Channel_IsLocal(c) (Channel_Name(c)[0] == '&')
+
+
#endif
+
/* -eof- */
blob - 586d46cabd8c7f3ebd341442ab41f1208de45314
blob + 27414d38b5771666c402dba0a259018e6f6e06df
--- src/ngircd/irc-channel.c
+++ src/ngircd/irc-channel.c
else
modes[0] = '\0';
- /* forward to other servers */
- snprintf(str, sizeof(str), "%s%s", channame, modes);
- IRC_WriteStrServersPrefixFlag_CB(Client, target, '\0', cb_join_forward, str);
+ /* forward to other servers (if it is not a local channel) */
+ if (!Channel_IsLocal(chan)) {
+ snprintf(str, sizeof(str), "%s%s", channame, modes);
+ IRC_WriteStrServersPrefixFlag_CB(Client, target, '\0',
+ cb_join_forward, str);
+ }
/* tell users in this channel about the new client */
- IRC_WriteStrChannelPrefix(Client, chan, target, false, "JOIN :%s", channame);
- if (modes[1])
- IRC_WriteStrChannelPrefix(Client, chan, target, false, "MODE %s +%s %s",
- channame, &modes[1], Client_ID(target));
-}
+ IRC_WriteStrChannelPrefix(Client, chan, target, false,
+ "JOIN :%s", channame);
+
+ /* syncronize channel modes */
+ if (modes[1]) {
+ IRC_WriteStrChannelPrefix(Client, chan, target, false,
+ "MODE %s +%s %s", channame,
+ &modes[1], Client_ID(target));
+ }
+} /* join_forward */
static bool
Client_TypeText(from), Client_Mask(from), Channel_Name(chan),
Req->argv[1][0] ? Req->argv[1] : "<none>");
- /* im Channel bekannt machen und an Server weiterleiten */
- IRC_WriteStrServersPrefix( Client, from, "TOPIC %s :%s", Req->argv[0], Req->argv[1] );
- IRC_WriteStrChannelPrefix( Client, chan, from, false, "TOPIC %s :%s", Req->argv[0], Req->argv[1] );
+ /* Update channel and forward new topic to other servers */
+ if (!Channel_IsLocal(chan))
+ IRC_WriteStrServersPrefix(Client, from, "TOPIC %s :%s",
+ Req->argv[0], Req->argv[1]);
+ IRC_WriteStrChannelPrefix(Client, chan, from, false, "TOPIC %s :%s",
+ Req->argv[0], Req->argv[1]);
- if( Client_Type( Client ) == CLIENT_USER ) return IRC_WriteStrClientPrefix( Client, Client, "TOPIC %s :%s", Req->argv[0], Req->argv[1] );
- else return CONNECTED;
+ if (Client_Type(Client) == CLIENT_USER)
+ return IRC_WriteStrClientPrefix(Client, Client, "TOPIC %s :%s",
+ Req->argv[0], Req->argv[1]);
+ else
+ return CONNECTED;
} /* IRC_TOPIC */
blob - 34198bf3e7e2b30ff8a0679d3dbdcbbb0633f547
blob + ee60566ecd9a0ea366fd888c92528594c4d65343
--- src/ngircd/irc-info.c
+++ src/ngircd/irc-info.c
cl2chan = Channel_NextChannelOf( c, cl2chan );
/* Secret channel? */
- if( strchr( Channel_Modes( chan ), 's' ) && ! Channel_IsMemberOf( chan, Client )) continue;
+ if (strchr(Channel_Modes(chan), 's')
+ && !Channel_IsMemberOf(chan, Client))
+ continue;
+ /* Local channel and request is not from a user? */
+ if (Client_Type(Client) == CLIENT_SERVER
+ && Channel_IsLocal(chan))
+ continue;
+
/* Concatenate channel names */
if( str[strlen( str ) - 1] != ':' ) strlcat( str, " ", sizeof( str ));
if( strchr( Channel_UserModes( chan, c ), 'o' )) strlcat( str, "@", sizeof( str ));
blob - 76e3ab4677fd40d372e99187c4481ba9b54781db
blob + ed70a9bb9d3618519e6ad5f2837cba0a600f7742
--- src/ngircd/irc-mode.c
+++ src/ngircd/irc-mode.c
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2005 Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
*
* 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
the_modes[len] = '\0';
if (Client_Type(Client) == CLIENT_SERVER) {
- /* Forward mode changes to channel users and other servers */
+ /* MODE requests for local channels from other servers
+ * are definitely invalid! */
+ if (Channel_IsLocal(Channel)) {
+ Log(LOG_ALERT, "Got remote MODE command for local channel!? Ignored.");
+ return CONNECTED;
+ }
+
+ /* Forward mode changes to channel users and all the
+ * other remote servers: */
IRC_WriteStrServersPrefix(Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args);
IRC_WriteStrChannelPrefix(Client, Channel, Origin, false, "MODE %s %s%s", Channel_Name(Channel), the_modes, the_args);
} else {
/* Send reply to client and inform other servers and channel users */
ok = IRC_WriteStrClientPrefix(Client, Origin, "MODE %s %s%s",
Channel_Name(Channel), the_modes, the_args);
- IRC_WriteStrServersPrefix(Client, Origin, "MODE %s %s%s",
- Channel_Name(Channel), the_modes, the_args);
- IRC_WriteStrChannelPrefix(Client, Channel, Origin, false, "MODE %s %s%s",
- Channel_Name(Channel), the_modes, the_args);
+ /* Only forward requests for non-local channels */
+ if (!Channel_IsLocal(Channel))
+ IRC_WriteStrServersPrefix(Client, Origin,
+ "MODE %s %s%s", Channel_Name(Channel),
+ the_modes, the_args);
+ IRC_WriteStrChannelPrefix(Client, Channel, Origin,
+ false, "MODE %s %s%s", Channel_Name(Channel),
+ the_modes, the_args);
}
}
blob - 36d6f48e6e5409fd20932b47f7c3640a6583edec
blob + d6a92c96b9b1fc4bfe8d1ee584389f48ebe13326
--- src/ngircd/messages.h
+++ src/ngircd/messages.h
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2004 Alexander Barton <alex@barton.de>
+ * Copyright (c)2001-2008 Alexander Barton <alex@barton.de>
*
* 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
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
- * $Id: messages.h,v 1.75 2008/02/17 13:26:42 alex Exp $
- *
* IRC numerics (Header)
*/
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
#define RPL_CREATED_MSG "003 %s :This server has been started %s"
#define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s"
-#define RPL_ISUPPORT1_MSG "005 %s RFC2812 CASEMAPPING=ascii PREFIX=(ov)@+ CHANTYPES=# CHANMODES=bI,k,l,imnPst CHANLIMIT=#:%d :are supported on this server"
+#define RPL_ISUPPORT1_MSG "005 %s RFC2812 CASEMAPPING=ascii PREFIX=(ov)@+ CHANTYPES=#&+ CHANMODES=bI,k,l,imnPst CHANLIMIT=#&+:%d :are supported on this server"
#define RPL_ISUPPORT2_MSG "005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d PENALTY :are supported on this server"
#define RPL_TRACELINK_MSG "200 %s Link %s-%s %s %s V%s %ld %d %d"
blob - fa32097d027ef66e42f1667f3ca23f9d06e907a1
blob + 74c5c12bebc44f6056ba2dc0f04856cda3deb242
--- src/ngircd/numeric.c
+++ src/ngircd/numeric.c
/* Announce all channels to the new server */
chan = Channel_First();
while (chan) {
+ if (Channel_IsLocal(chan)) {
+ chan = Channel_Next(chan);
+ continue;
+ }
#ifdef IRCPLUS
/* Send CHANINFO if the peer supports it */
if (strchr(Client_Flags(Client), 'C')) {