public ChannelManager(ServerPrx server, string channel) { m_server = server; // Update list of channels lock (chan_ids) foreach (var child in m_server.getTree().children) { chan_ids[child.c.name] = child.c.id; } // Set channel if it was found, create it if it wasn't lock (chan_ids) if (chan_ids.ContainsKey(channel)) { parent_chan = chan_ids[channel]; } else { parent_chan = m_server.addChannel(channel, 0); } // Set permissions on channels Murmur.ACL[] acls = new Murmur.ACL[1]; acls[0] = new Murmur.ACL(true, true, false, -1, "all", Murmur.PermissionSpeak.value, Murmur.PermissionEnter.value); m_log.DebugFormat("[MurmurVoice] Setting ACLs on channel"); m_server.setACL(parent_chan, acls, null, true); }
/// <summary> /// Links channels together so that destination can hear source /// </summary> public void LinkChannel(int sourceID, int destinationID, bool oneWay = true) { var channels = server.getChannels(); // link channels var srcChan = channels[sourceID]; var dstChan = channels[destinationID]; srcChan.links = AddToArray(srcChan.links, destinationID); dstChan.links = AddToArray(dstChan.links, sourceID); server.setChannelState(srcChan); server.setChannelState(dstChan); if (oneWay) { // set ACL (dont let source hear destination) server.setACL(sourceID, new[] { new ACL(true, true, false, -1, "all", 0, (int)Permission.Speak), new ACL(true, true, false, -1, "in", (int)Permission.Speak, 0) }, null, true); } }
/// <summary> /// Update exist channel /// </summary> /// <param name="channel"></param> /// <param name="setAcl">add acls and groups?</param> public void UpdateChannel(VirtualServerEntity.Channel channel, bool setAcl = false) { // set channel info var state = new Channel(channel.Id, channel.Name, channel.ParentId, channel.Links, channel.Description, false, channel.Position); // WARNING! LINKS MUST BE VALID OR InvalidChannelException will be thrown _server.setChannelState(state); if (setAcl) { // set groups Group[] groups = new Group[channel.Groups.Count]; for (int i = 0; i < channel.Groups.Count; i++) { var g = channel.Groups[i]; groups[i] = new Group(g.Name, g.Inherited, g.Inherit, g.Inheritable, g.Add, g.Remove, g.Members); } // set acls ACL[] acls = new ACL[channel.Acls.Count]; for (int i = 0; i < channel.Acls.Count; i++) { var a = channel.Acls[i]; acls[i] = new ACL(a.ApplyHere, a.ApplySubs, a.Inherited, a.UserId, a.Group, a.Allow, a.Deny); } _server.setACL(channel.Id, acls, groups, channel.InheritAcl); } // update in cache if (_entity.Channels.ContainsKey(channel.Id)) { _entity.Channels[channel.Id] = channel; } else { _entity.Channels.Add(channel.Id, channel); } }
public ChannelManager(ServerPrx server, string channel) { m_server = server; // Update list of channels lock (chan_ids) foreach (var child in m_server.getTree().children) { chan_ids[child.c.name] = child.c.id; } // Set channel if it was found, create it if it wasn't lock (chan_ids) if (chan_ids.ContainsKey(channel)) { parent_chan = chan_ids[channel]; } else { parent_chan = m_server.addChannel(channel, 0); } // Set permissions on channels Murmur.ACL[] acls = new Murmur.ACL[1]; acls[0] = new Murmur.ACL(); acls[0].group = "all"; acls[0].applyHere = true; acls[0].applySubs = true; acls[0].inherited = false; acls[0].userid = -1; acls[0].allow = Murmur.PermissionSpeak.value; acls[0].deny = Murmur.PermissionEnter.value; m_log.DebugFormat("[MurmurVoice] Setting ACLs on channel"); m_server.setACL(parent_chan, acls, (new List <Murmur.Group>()).ToArray(), true); }
public ChannelManager(ServerPrx server, string estatechan) { m_server = server; Murmur.Tree ServerTree; estate_chan = -1; // check list of channels ServerTree = m_server.getTree(); lock(chan_ids) { foreach(var child in ServerTree.children) { if(child.c.name == estatechan) { chan_ids[child.c.name] = child.c.id; estate_chan = child.c.id; m_log.DebugFormat("[MurmurVoice]: Estate channel {0} already created id {1}", child.c.name,child.c.id); break; } } } // create it if it wasn't found if(estate_chan == -1) { estate_chan = m_server.addChannel(estatechan, 0); chan_ids[estatechan]=estate_chan; m_log.InfoFormat("[MurmurVoice]: Estate channel {0} created id {1}",estatechan,estate_chan); // Set permissions on channels Murmur.ACL[] acls = new Murmur.ACL[1]; acls[0] = new Murmur.ACL(); acls[0].group = "all"; acls[0].applyHere = true; acls[0].applySubs = true; acls[0].inherited = false; acls[0].userid = -1; acls[0].allow = Murmur.PermissionSpeak.value; acls[0].deny = Murmur.PermissionEnter.value; m_server.setACL(estate_chan, acls, (new List<Murmur.Group>()).ToArray(), true); } }
public ChannelManager(ServerPrx server, string channel) { m_server = server; // Update list of channels lock (chan_ids) foreach (var child in m_server.getTree().children) chan_ids[child.c.name] = child.c.id; // Set channel if it was found, create it if it wasn't lock (chan_ids) if (chan_ids.ContainsKey(channel)) parent_chan = chan_ids[channel]; else parent_chan = m_server.addChannel(channel, 0); // Set permissions on channels Murmur.ACL[] acls = new Murmur.ACL[1]; acls[0] = new Murmur.ACL(); acls[0].group = "all"; acls[0].applyHere = true; acls[0].applySubs = true; acls[0].inherited = false; acls[0].userid = -1; acls[0].allow = Murmur.PermissionSpeak.value; acls[0].deny = Murmur.PermissionEnter.value; m_log.DebugFormat("[MurmurVoice] Setting ACLs on channel"); m_server.setACL(parent_chan, acls, (new List<Murmur.Group>()).ToArray(), true); }
public ChannelManager(ServerPrx server, string channel) { m_server = server; // Update list of channels lock (chan_ids) foreach (var child in m_server.getTree().children) chan_ids[child.c.name] = child.c.id; // Set channel if it was found, create it if it wasn't lock (chan_ids) if (chan_ids.ContainsKey(channel)) parent_chan = chan_ids[channel]; else parent_chan = m_server.addChannel(channel, 0); // Set permissions on channels Murmur.ACL[] acls = new Murmur.ACL[1]; acls[0] = new Murmur.ACL(true, true, false, -1, "all", Murmur.PermissionSpeak.value, Murmur.PermissionEnter.value); m_log.DebugFormat("[MurmurVoice] Setting ACLs on channel"); m_server.setACL(parent_chan, acls, null, true); }