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); }
public int GetOrCreate(string name) { lock (chan_ids) { if (chan_ids.ContainsKey(name)) { return(chan_ids[name]); } m_log.DebugFormat("[MurmurVoice] Channel '{0}' not found. Creating.", name); return(chan_ids[name] = m_server.addChannel(name, parent_chan)); } }
public int GetOrCreateChannelID(params string[] path) { var parentId = 0; var channels = server.getChannels().Values; foreach (var node in path) { var entry = channels.FirstOrDefault(x => x.parent == parentId && string.Equals(x.name, node, StringComparison.InvariantCultureIgnoreCase)); if (entry != null) { parentId = entry.id; } else { parentId = server.addChannel(node, parentId); } } return(parentId); }
/// <summary> /// Add new channel /// </summary> /// <param name="name"></param> /// <param name="parentId"></param> /// <returns>user id</returns> public int AddChannel(string name, int parentId) { int cid = 0; // only one root channel is available (it has parent id = -1 and can't be removed or added) if (parentId > -1) { // add channel cid = _server.addChannel(name, parentId); } // add in cache if not exist if (!_entity.Channels.ContainsKey(cid)) { _entity.Channels.Add(cid, new VirtualServerEntity.Channel() { Id = cid, Name = name, ParentId = parentId }); } return(cid); }
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); }