Example #1
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="other"></param>
 public ChannelEntry(ChannelEntry other)
 {
     Channel = other.Channel;
     User = other.User;
     Op = other.Op;
     Voice = other.Voice;
     HalfOp = other.HalfOp;
 }
Example #2
0
 /// <summary>
 /// For internal use only
 /// </summary>
 public bool OnAddToChannel(ChannelEntry channel)
 {
     lock (lockObject)
     {
         if (channels.ContainsKey(channel.Channel.Name))
         {
             return false;
         }
         channels.Add(channel.Channel.Name, channel);
         return true;
     }
 }
Example #3
0
        /// <summary>
        /// Adds a user to the channel
        /// </summary>
        /// <param name="user"></param>
        /// <param name="op"></param>
        /// <param name="voice"></param>
        /// <param name="halfop"></param>
        /// <returns>TRUE if the user is successfully added</returns>
        public bool AddUser(IUser user, bool op, bool voice, bool halfop)
        {
            lock (lockObject)
            {
                if (user.IsOnChannel(Name))
                {
                    return false;
                }
                ChannelEntry entry = new ChannelEntry(this, user);
                entry.Op = op;
                entry.Voice = voice;
                entry.HalfOp = halfop;

                var list = user.Server.ChannelEntries[this] as List<ChannelEntry>;
                list.Add(entry);
                (user as User).OnAddToChannel(entry);

                if (Service.BurstCompleted)
                {
                    RemoveInvitation(user);
                }
                return true;
            }
        }