X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fchannel.c;h=8d001a825c013e8c77e339f5915a54eac792b6fa;hp=90d2efab3e191f7ef1f3931bb1f2de6e90e5837d;hb=f37600ee01f6cfd86e8fa80f77ee26ebaf3012b2;hpb=097c72aa65d9914d688eaece718648ca060e287a diff --git a/src/ngircd/channel.c b/src/ngircd/channel.c index 90d2efab..8d001a82 100644 --- a/src/ngircd/channel.c +++ b/src/ngircd/channel.c @@ -66,16 +66,8 @@ static void Set_KeyFile PARAMS((CHANNEL *Chan, const char *KeyFile)); GLOBAL void Channel_Init( void ) { - CHANNEL *sc; - My_Channels = NULL; My_Cl2Chan = NULL; - - sc = Channel_Create("&SERVER"); - if (sc) { - Channel_SetModes(sc, "mnPt"); - Channel_SetTopic(sc, Client_ThisServer(), "Server Messages"); - } } /* Channel_Init */ @@ -103,11 +95,12 @@ Channel_GetListInvites(CHANNEL *c) } +/** + * Generate predefined persistent channels and &SERVER + */ GLOBAL void Channel_InitPredefined( void ) { - /* Generate predefined persistent channels */ - CHANNEL *new_chan; const struct Conf_Channel *conf_chan; const char *c; @@ -160,6 +153,18 @@ Channel_InitPredefined( void ) } if (channel_count) array_free(&Conf_Channels); + + /* Make sure the local &SERVER channel exists */ + if (!Channel_Search("&SERVER")) { + new_chan = Channel_Create("&SERVER"); + if (new_chan) { + Channel_SetModes(new_chan, "mnPt"); + Channel_SetTopic(new_chan, Client_ThisServer(), + "Server Messages"); + } else + Log(LOG_ERR, "Failed to create \"&SERVER\" channel!"); + } else + LogDebug("Required channel \"&SERVER\" already exists, ok."); } /* Channel_InitPredefined */ @@ -877,6 +882,10 @@ Can_Send_To_Channel(CHANNEL *Chan, CLIENT *From) if (strchr(Channel_Modes(Chan), 'n') && !is_member) return false; + if (strchr(Channel_Modes(Chan), 'M') && !Client_HasMode(From, 'R') + && !Client_HasMode(From, 'o')) + return false; + if (has_voice || is_halfop || is_op || is_chanadmin || is_owner) return true;