Add silent channel option
authorMartin Johansson <martin@fatbob.nu>
Sat, 5 Oct 2013 20:12:25 +0000 (22:12 +0200)
committerMartin Johansson <martin@fatbob.nu>
Sat, 5 Oct 2013 20:12:25 +0000 (22:12 +0200)
src/channel.h
src/client.c
src/conf.c
src/conf.h
umurmur.conf.example

index 3df0af3f9f777ffa920eb298b0919085e7a5916b..c32ae5be41d18551ddc162e4f054cf226b2bcc37 100644 (file)
@@ -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;
index 9bca358d2369f0c40312d481c23d8c0675016700..f2fda4c45bd9f044f7b3cf381288f02a82188ff0 100644 (file)
@@ -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;
index a110056d3e1cef926fc9a11bacf4c451ee7ddcd4..447061f46d5c93047791e4ba9b5968d728629ad9 100644 (file)
@@ -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;
 }
index 62d755b97008c7b54140a1554d2981cf67691398..d30ed416b1667741b4bd74cc036312acfd199f98 100644 (file)
@@ -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 {
index 5fd24bc7ec786c5bd22ca738c6577fb70c78fab5..f12aae321327d143d489703eb8568922d6fd0d5c 100644 (file)
@@ -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";