From: Martin Johansson Date: Sat, 5 Oct 2013 20:12:25 +0000 (+0200) Subject: Add silent channel option X-Git-Url: http://git.code-monkey.de/?p=umurmur.git;a=commitdiff_plain;h=c7a24ac8471652b8443453d8f02acd7b85a68d60 Add silent channel option --- diff --git a/src/channel.h b/src/channel.h index 3df0af3..c32ae5b 100644 --- a/src/channel.h +++ b/src/channel.h @@ -41,7 +41,7 @@ typedef struct channel { char *desc; char *password; struct channel *parent; - bool_t temporary, noenter; + bool_t temporary, noenter, silent; struct dlist node; struct dlist subs; struct dlist clients; diff --git a/src/client.c b/src/client.c index 9bca358..f2fda4c 100644 --- a/src/client.c +++ b/src/client.c @@ -871,7 +871,7 @@ int Client_voiceMsg(client_t *client, uint8_t *data, int len) channel_t *ch = (channel_t *)client->channel; struct dlist *itr; - if (!client->authenticated || client->mute || client->self_mute) + if (!client->authenticated || client->mute || client->self_mute || ch->silent) goto out; packetsize = 20 + 8 + 4 + len; diff --git a/src/conf.c b/src/conf.c index a110056..447061f 100644 --- a/src/conf.c +++ b/src/conf.c @@ -333,6 +333,13 @@ int Conf_getNextChannel(conf_channel_t *chdesc, int index) chdesc->noenter = false; else chdesc->noenter = config_setting_get_bool(setting); + + ret = snprintf(configstr, maxconfig, "channels.[%d].silent", index); + setting = config_lookup(&configuration, configstr); + if (ret >= maxconfig || ret < 0 || setting == NULL) /* Optional */ + chdesc->silent = false; + else + chdesc->silent = config_setting_get_bool(setting); return 0; } diff --git a/src/conf.h b/src/conf.h index 62d755b..d30ed41 100644 --- a/src/conf.h +++ b/src/conf.h @@ -55,6 +55,7 @@ typedef enum param { BANFILE, SYNC_BANFILE, OPUS_THRESHOLD, + SILENT_CHANNEL, } param_t; typedef struct { @@ -62,7 +63,7 @@ typedef struct { const char *name; const char *description; const char *password; - bool_t noenter; + bool_t noenter, silent; } conf_channel_t; typedef struct { diff --git a/umurmur.conf.example b/umurmur.conf.example index 5fd24bc..f12aae3 100644 --- a/umurmur.conf.example +++ b/umurmur.conf.example @@ -40,6 +40,12 @@ channels = ( { description = "Lobby channel"; }, { + name = "Silent"; + parent = "Root"; + description = "Silent channel"; + silent = true; # Default is false + }, + { name = "Red team"; parent = "Lobby"; description = "The Red team channel";