Inheritance: IrcUser, IIrcMessageSendHandler, IIrcMessageReceiveHandler, IIrcMessageReceiver
Esempio n. 1
0
        private static void HandleEventLoop(IrcClient client)
        {
            _ircLocaluser = client.LocalUser;
              _hostNameToWebSockets.Add("", new WebSocketListenerClient(PrivateConstants.TestAccountWebsocketAuth));
              _hostNameToWebSockets[""].Run(sendToIrcProcessor);

              bool isExit = false;
              while (!isExit) {
            Console.Write("> ");
            var command = Console.ReadLine();
            switch (command) {
              case "exit":
            isExit = true;
            break;
              default:
            if (!string.IsNullOrEmpty(command)) {
              if (command.StartsWith("/") && command.Length > 1) {
                client.SendRawMessage(command.Substring(1));
              } else {
                Console.WriteLine($"Unknown command '{command}'");
              }
            }
            break;
            }
              }
              client.Disconnect();
        }
 private void SendGreeting(IrcLocalUser localUser, IIrcMessageTarget target)
 {
     localUser.SendNotice(target, "This is the {0}, welcome.", ProgramInfo.AssemblyTitle);
     localUser.SendNotice(target, "Message me with '.help' for instructions on how to use me.");
     localUser.SendNotice(target, "Remember to log in via a private message and not via the channel.");
 }
Esempio n. 3
0
 /// <summary>
 /// </summary>
 /// <param name="localUser">
 /// </param>
 /// <param name="e">
 /// </param>
 protected abstract void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e);
 public static void SendNotice(this IrcLocalUser localUser, IList <IIrcMessageTarget> targets, string format,
                               params object[] args)
 {
     localUser.SendNotice(targets, string.Format(format, args));
 }
Esempio n. 5
0
 protected virtual void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
 }
Esempio n. 6
0
 internal void SetLocalUserModes(IrcLocalUser user, string modes)
 {
     SendMessageUserMode(user.NickName, modes);
 }
Esempio n. 7
0
 protected virtual void ResetState()
 {
     // Reset fully state of client.
     this.servers = new Collection<IrcServer>();
     this.isRegistered = false;
     this.localUser = null;
     this.serverSupportedFeatures = new Dictionary<string, string>();
     this.serverSupportedFeaturesReadOnly = new ReadOnlyDictionary<string, string>(this.serverSupportedFeatures);
     this.channelUserModes = new Collection<char>() {
         'o', 'v' };
     this.channelUserModesReadOnly = new ReadOnlyCollection<char>(this.channelUserModes);
     this.channelUserModesPrefixes = new Dictionary<char, char>() {
         { '@', 'o' }, { '+', 'v' } };
     this.motdBuilder = new StringBuilder();
     this.networkInformation = new IrcNetworkInfo();
     this.channels = new Collection<IrcChannel>();
     this.channelsReadOnly = new IrcChannelCollection(this, this.channels);
     this.users = new Collection<IrcUser>();
     this.usersReadOnly = new IrcUserCollection(this, this.users);
     this.listedChannels = new List<IrcChannelInfo>();
     this.listedServerLinks = new List<IrcServerInfo>();
     this.listedStatsEntries = new List<IrcServerStatisticalEntry>();
 }
Esempio n. 8
0
 protected override void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     //
 }
Esempio n. 9
0
        protected override void OnLocalUserJoinedChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
        {
            thisclient.FloodPreventer = new IrcStandardFloodPreventer(2,4000);
            thisclient.WhoReplyReceived += UserListUpdate;
            if (xmlprovider.runningVotes().Count() > 0)
            {
                VoteTimer = new System.Timers.Timer(5000);
                VoteTimer.Elapsed += OnVoteTimerEvent;
                VoteTimer.Enabled = true;
            }
            //OnClientRegistered may happen before joined channel thus...
            _streamProviderManager = new StreamProviderManager();
            _streamProviderManager.StreamStarted += OnStreamStarted;
            _streamProviderManager.StreamStopped += OnStreamStopped;
            _streamProviderManager.StreamGlobalNotification += OnStreamGlobalNotification;
            _streamProviderManager.AddStreamProvider(new TwitchProvider());
            _streamProviderManager.AddStreamProvider(new HitboxProvider());
            //localUser.Client.WhoReplyReceived += WhoReplyReceived;

            if (reconnectimer != null)
            {
                reconnectimer.Dispose();
            }

            if (!debug)
            {
                reconnectimer = new System.Timers.Timer(150000);
            }
            else
            {
                reconnectimer = new System.Timers.Timer(240000);
            }
            reconnectimer.Elapsed += OnReconnectTimer;
            reconnectimer.Enabled = true;
        }
Esempio n. 10
0
 protected override void OnLocalUserNoticeReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     Trace.TraceInformation("OnLocalUserNoticeReceived: " + e.Text);
 }
Esempio n. 11
0
 protected override void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     if (e.Source.Name != localUser.NickName)
         Trace.TraceInformation("OnLocalUserMessageReceived: " + e.Text);
 }
Esempio n. 12
0
 protected override void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     Trace.TraceInformation("OnLocalUserLeftChannel");
 }
Esempio n. 13
0
        private void HandleClientConnected(IrcRegistrationInfo regInfo)
        {
            Logger.WriteLine("Connected to server at '{0}'.", TraceEventType.Verbose,((IPEndPoint)this.socket.RemoteEndPoint).Address);
            
            if (regInfo.Password != null)
                // Authenticate with server using password.
                SendMessagePassword(regInfo.Password);

            // Check if client is registering as service or normal user.
            if (regInfo is IrcServiceRegistrationInfo)
            {
                // Register client as service.
                var serviceRegInfo = (IrcServiceRegistrationInfo)regInfo;
                SendMessageService(serviceRegInfo.NickName, serviceRegInfo.Distribution,
                    serviceRegInfo.Description);

                this.localUser = new IrcLocalUser(serviceRegInfo.NickName, serviceRegInfo.Distribution,
                    serviceRegInfo.Description);
            }
            else
            {
                // Register client as normal user.
                var userRegInfo = (IrcUserRegistrationInfo)regInfo;
                SendMessageNick(userRegInfo.NickName);
                SendMessageUser(userRegInfo.UserName, GetNumericUserMode(userRegInfo.UserModes),
                    userRegInfo.RealName);

                this.localUser = new IrcLocalUser(userRegInfo.NickName, userRegInfo.UserName, userRegInfo.RealName,
                    userRegInfo.UserModes);
            }
            this.localUser.Client = this;

            // Add local user to list of known users.
            lock (((ICollection)this.usersReadOnly).SyncRoot)
                this.users.Add(this.localUser);

            OnConnected(new EventArgs());
        }
Esempio n. 14
0
 protected override void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     //Console.WriteLine("{0}", e.Source.ToString());
 }
Esempio n. 15
0
 protected override void OnLocalUserJoinedChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
 }
 protected override void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     //
 }
Esempio n. 17
0
 protected abstract void OnLocalUserQuit(IrcLocalUser localUser, IrcCommentEventArgs e);
Esempio n. 18
0
 protected override void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     ReconnectInbound = false;
 }
Esempio n. 19
0
        protected virtual void HandleClientConnected(IrcRegistrationInfo regInfo)
        {
            if (regInfo.Password != null)
                // Authenticate with server using password.
                SendMessagePassword(regInfo.Password);

            // Check if client is registering as service or normal user.
            if (regInfo is IrcServiceRegistrationInfo)
            {
                // Register client as service.
                var serviceRegInfo = (IrcServiceRegistrationInfo)regInfo;
                SendMessageService(serviceRegInfo.NickName, serviceRegInfo.Distribution,
                    serviceRegInfo.Description);

                this.localUser = new IrcLocalUser(serviceRegInfo.NickName, serviceRegInfo.Distribution,
                    serviceRegInfo.Description);
            }
            else
            {
                // Register client as normal user.
                var userRegInfo = (IrcUserRegistrationInfo)regInfo;
                SendMessageNick(userRegInfo.NickName);
                SendMessageUser(userRegInfo.UserName, GetNumericUserMode(userRegInfo.UserModes),
                    userRegInfo.RealName);

                this.localUser = new IrcLocalUser(userRegInfo.NickName, userRegInfo.UserName, userRegInfo.RealName,
                    userRegInfo.UserModes);
            }
            this.localUser.Client = this;

            // Add local user to list of known users.
            lock (((ICollection)this.usersReadOnly).SyncRoot)
                this.users.Add(this.localUser);

            OnConnected(new EventArgs());
        }
Esempio n. 20
0
 protected virtual void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
 }
Esempio n. 21
0
 internal void GetLocalUserModes(IrcLocalUser user)
 {
     SendMessageUserMode(user.NickName);
 }
Esempio n. 22
0
 protected virtual void OnLocalUserNoticeReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
 }
Esempio n. 23
0
 private void SubscribeToRegisteredClientEvents(IrcLocalUser user)
 {
     user.JoinedChannel += OnJoinedChannel;
     user.MessageReceived += OnMessageReceived;
 }
Esempio n. 24
0
 protected override void OnLocalUserJoinedChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     ChannelsToRejoin.Add(e.Channel.Name);
 }
Esempio n. 25
0
 protected virtual void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
 }
Esempio n. 26
0
 protected override void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     if(AutoRejoin) {
         localUser.Client.Channels.Join(e.Channel.Name);
     }
 }
 public static void SendMessage(this IrcLocalUser localUser, IIrcMessageTarget target, string format,
                                params object[] args)
 {
     SendMessage(localUser, new[] { target }, format, args);
 }
Esempio n. 28
0
 protected override void OnLocalUserQuit(IrcLocalUser localUser, IrcCommentEventArgs e)
 {
     Console.WriteLine("Quit: {0}",e.Comment);
 }
Esempio n. 29
0
 /// <summary>
 /// </summary>
 /// <param name="localUser">
 /// </param>
 /// <param name="e">
 /// </param>
 protected abstract void OnLocalUserNoticeReceived(IrcLocalUser localUser, IrcMessageEventArgs e);
Esempio n. 30
0
 private void SendGreeting(IrcLocalUser localUser, IIrcMessageTarget target)
 {
     localUser.SendNotice(target, "This is the {0}, welcome.", ProgramInfo.AssemblyTitle);
     localUser.SendNotice(target, "Message me with '.help' for instructions on how to use me.");
     localUser.SendNotice(target, "Remember to log in via a private message and not via the channel.");
 }
 protected override void OnLocalUserJoinedChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     SendGreeting(localUser, e.Channel);
 }
Esempio n. 32
0
 protected override void OnLocalUserJoinedChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     SendGreeting(localUser, e.Channel);
 }
 protected override void OnLocalUserMessageReceived(IrcLocalUser localUser, IrcMessageEventArgs e)
 {
     //
 }
Esempio n. 34
0
 protected override void OnLocalUserLeftChannel(IrcLocalUser localUser, IrcChannelEventArgs e)
 {
     //
 }