Beispiel #1
0
 public IRCUser(IRCChannel pChannel, IRCNode pNode)
 {
     nickname = pNode.Nickname;
     channel = pChannel;
     isOperator = false;
     hasVoice = false;
     node = pNode;
 }
Beispiel #2
0
 public IRCUser(string pNickname, IRCChannel pChannel, bool pOperator, bool pVoice)
 {
     nickname = pNickname;
     channel = pChannel;
     isOperator = pOperator;
     hasVoice = pVoice;
     node = null;
 }
Beispiel #3
0
        public fChannel(IRCChannel pChannel, IRCManager pManager)
        {
            InitializeComponent();

            // plug into Manager from KickedFromChannel
            manager = pManager;
            managerKickedFromChannel = new IRCManager.ChannelEventHandler(ManagerKickedFromChannel);
            pManager.KickedFromChannel += managerKickedFromChannel;

            // setup
            SetChannel(pChannel);
        }
Beispiel #4
0
        public IRCUser(string pNickname, IRCChannel pChannel)
        {
            nickname = pNickname;
            channel = pChannel;

            // evaluate nickname
            if (pNickname.Substring(0, 1) == "@")
                isOperator = true;
            else
                isOperator = false;
            if (pNickname.Substring(0, 1) == "+")
                hasVoice = true;
            else
                hasVoice = false;

            // remove +/@ if necessarry
            if (isOperator || hasVoice)
                nickname = pNickname.Substring(1);

            node = null;
        }
Beispiel #5
0
 public ChannelEventArgs(IRCChannel pChannel)
 {
     channel = pChannel;
 }
Beispiel #6
0
 public IRCChannel JoinChannel(string pChannelname)
 {
     // create channel-object and return result
     IRCChannel channel = new IRCChannel(Connection, pChannelname);
     channels.Add(pChannelname.ToLower(), channel);
     return channel;
 }
Beispiel #7
0
        private void SetChannel(IRCChannel pChannel)
        {
            this.channel = pChannel;
            this.connection = channel.Connection;

            // setup user list
            fChannelUsers.Items.Clear();
            foreach (DictionaryEntry d in channel.Users)
            {
                fChannelUsers.Items.Add(d.Value);
            }

            // set window title
            this.Text = channel.ChannelName + " - " + channel.Topic;

            // setup event-handlers
            channelUserStatusChanged = new IRCChannel.UserStatusChangeEventHandler(ChannelUserStatusChanged);
            channelGotMessage = new IRCConnection.MessageEventHandler(ChannelGotMessage);
            channelSentMessage = new IRCConnection.MessageEventHandler(ChannelSentMessage);
            channelTopicChanged = new IRCConnection.MessageEventHandler(ChannelTopicChanged);
            channelModesChanged = new IRCConnection.MessageEventHandler(ChannelModesChanged);
            channelNamesChanged = new IRCConnection.MessageEventHandler(ChannelNamesChanged);
            channelLocalUserLeft = new IRCConnection.MessageEventHandler(ChannelLocalUserLeft);

            // plug-in to channel via event-handlers
            channel.UserStatusChanged += channelUserStatusChanged;
            channel.GotMessage += channelGotMessage;
            channel.SentMessage += channelGotMessage;
            channel.TopicChanged += channelTopicChanged;
            channel.ModesChanged += channelModesChanged;
            channel.NamesChanged += channelNamesChanged;
            channel.LocalUserLeftChannel += channelLocalUserLeft;
        }
Beispiel #8
0
        private void ChannelUserStatusChanged(object sender, IRCChannel.UserStatusChangeEventArgs e)
        {
            if (InvokeRequired)
            {
                Invoke(new Action(delegate { ChannelUserStatusChanged(sender, e); }));
                return;
            }

            // retrieve user in question from list and update
            int index = fChannelUsers.Items.IndexOf(e.NewUser);
            if (index >= 0)
                fChannelUsers.Items[index] = e.NewUser;

            // printing message
            if (e.Quit)
            {
                string name = e.NewUser.NicknameInChannel;
                Log(name + " QUIT: " + e.Message.Body, Color.DarkRed);
            }
            else if (e.Left)
            {
                string name = e.NewUser.NicknameInChannel;
                Log(name + " hat den Channel verlassen.", Color.DarkRed);
            }
            else if (e.Message.MessageTypeID.Equals(IRCConstants.MSG_NICK, StringComparison.OrdinalIgnoreCase))
            {
                Log(e.Message.SenderNode.Nickname + " heißt jetzt " + e.Message.Body + ".", Color.DarkRed);
            }
            else
            {   // everything else
                Log(e.Message.ToString(), Color.DarkRed);
            }

            // process depending on status change
            if (e.Left || e.Quit || e.Kicked)
                fChannelUsers.Items.Remove(e.NewUser);
            else if (e.Joined)
                fChannelUsers.Items.Add(e.NewUser);
        }