Beispiel #1
0
        private void HandleIncomingMessage(RemoteServer server, MessageEventArgs args)
        {
            // TODO!!!: Refactor so that the new event args can parse themselves from server and mesasge args
            // use the event dispatcher with a callback to the client

            Message msg = args.Message;

            OnMessage(server, args);

            if (msg.Command == Command.PRIVMSG)
            {
                // TODO
            }
            if (msg.Command.IsErrorCode())
            {
                OnError(server, new ReasonEventArgs(msg.LastParameter));
            }
            if (msg.Command == Command.NOTICE)
            {
                OnNotice(server, new ReasonEventArgs(msg.LastParameter));
            }
            if (msg.Command == Command.NICK)
            {
                // TODO: get old user and nick from from and new nick as lastparam
                //OnNickChanged(server, new NickChangedEventArgs())
            }
            if (msg.Command == Command.QUIT)
            {
                // TODO: get user from from and msg as lastparam.. get chan from list of chans
                //OnUserQuit(server, new ChannelUserEventArgs());
            }
            if (msg.Command == Command.TOPIC)
            {
                // get old topic from chan, get new from lastparam
            }
            // TODO: OnQuit, OnConnected, OnKicked, OnParted, OnJoined, OnUserJoined/Parted/Kicked
        }
Beispiel #2
0
 protected virtual void OnNotice(RemoteServer server, ReasonEventArgs args)
 {
     NoticeEvent?.Invoke(server, args);
 }
Beispiel #3
0
 protected virtual void OnQuit(RemoteServer server)
 {
     QuitEvent?.Invoke(server, EventArgs.Empty);
 }
Beispiel #4
0
 protected virtual void OnError(RemoteServer server, ReasonEventArgs args)
 {
     ErrorEvent?.Invoke(server, args);
 }
Beispiel #5
0
 protected virtual void OnNickChanged(RemoteServer server, NickChangedEventArgs args)
 {
     NickChangedEvent?.Invoke(server, args);
 }
Beispiel #6
0
 protected virtual void OnConnected(RemoteServer server)
 {
     ConnectedEvent?.Invoke(server, EventArgs.Empty);
 }
Beispiel #7
0
 protected virtual void OnModeChanged(RemoteServer server, ModeChangedEventArgs args)
 {
     ModeChangedEvent?.Invoke(server, args);
 }
Beispiel #8
0
 protected virtual void OnKickedFromChannel(RemoteServer server, ChannelEventArgs args)
 {
     KickedFromChannelEvent?.Invoke(server, args);
 }
Beispiel #9
0
 protected virtual void OnPartedChannel(RemoteServer server, ChannelEventArgs args)
 {
     PartedChannelEvent?.Invoke(server, args);
 }
Beispiel #10
0
 protected virtual void OnUserQuit(RemoteServer server, ChannelUserEventArgs args)
 {
     UserQuitEvent?.Invoke(server, args);
 }
Beispiel #11
0
 protected virtual void OnChannelTopicChanged(RemoteServer server, ChannelTopicChangedEventArgs args)
 {
     ChannelTopicChangedEvent?.Invoke(server, args);
 }