예제 #1
0
    public bool EnableNick(string channel, string nick)
    {
        ChannelThread thread = GetThread(channel);

        lock (thread.ChannelLock)
        {
            return(thread.DisabledNicks.Remove(nick));
        }
    }
예제 #2
0
    public bool DisableNick(string channel, string nick)
    {
        ChannelThread thread = GetThread(channel);

        // Hijack the channelLock to serialize modifications (Add/Remove) to DisabledNicks.
        lock (thread.ChannelLock)
        {
            return(thread.DisabledNicks.Add(nick));
        }
    }
예제 #3
0
    public void EnqueueMessage(string channel, string nick, string message)
    {
        var           item   = new MessageItem(nick, message);
        ChannelThread thread = GetThread(channel);

        lock (thread.ChannelLock)
        {
            thread.MessageQueue.Enqueue(item);
            Monitor.Pulse(thread.ChannelLock);
        }
    }
예제 #4
0
    ChannelThread GetThread(string channel)
    {
        ChannelThread thread;

        lock (channelThreads)
        {
            if (!channelThreads.TryGetValue(channel, out thread))
            {
                var wIrc = conf.ConstructWebToIrc(channel);
                thread = new ChannelThread(irc, log, Blacklist, Whitelist, wIrc, channel);
                channelThreads[channel] = thread;
            }

            return(thread);
        }
    }