Inheritance: IComparable, ChatTarget
Ejemplo n.º 1
0
 public IrcUser(IrcClient irc, string nick, IrcChannel chan)
     : this(irc)
 {
     m_nick = nick;
     m_comChans.Add(chan.Name, chan);
     irc.OnUserEncountered(this);
 }
Ejemplo n.º 2
0
 public virtual bool TriggersCommand(IrcUser user, IrcChannel chan, StringStream input)
 {
     return(CommandHandler.RemoteCommandPrefixes.Iterate(prefix => { if (input.String.StartsWith(prefix, StringComparison.CurrentCultureIgnoreCase))
                                                                     {
                                                                         input.Skip(prefix.Length); return true;
                                                                     }
                                                                     return false; }));
 }
Ejemplo n.º 3
0
 internal void ActionNotify(IrcUser user, IrcChannel channel, StringStream text)
 {
     if (channel != null)
     {
         channel.ActionNotify(user, text);
     }
     OnAction(user, channel, text);
 }
Ejemplo n.º 4
0
 public UnbanTimer(IrcChannel chan, string mask, TimeSpan timeout)
 {
     Channel           = chan;
     Mask              = mask;
     m_timer           = new Timer(timeout.TotalMilliseconds);
     m_timer.Elapsed  += OnTick;
     m_timer.AutoReset = false;
     chan.AddUnbanTimer(this);
     m_timer.Start();
 }
Ejemplo n.º 5
0
 public UnbanTimer(IrcChannel chan, string mask, TimeSpan timeout)
 {
     Channel = chan;
     Mask = mask;
     m_timer = new Timer(timeout.TotalMilliseconds);
     m_timer.Elapsed += OnTick;
     m_timer.AutoReset = false;
     chan.AddUnbanTimer(this);
     m_timer.Start();
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="voteQuestion">The string of the vote.</param>
        /// <param name="channel">The channel where the vote takes place.</param>
        /// <param name="lifeSpan">If null, the vote lasts indefinitely. Else sets the time the vote lasts before ending (seconds)</param>
        public Vote(string voteQuestion, IrcChannel channel, int lifeSpan)
        {
            m_Vote = voteQuestion;
            m_Chan = channel;
            m_CreationTime = DateTime.Now;

            m_Timer = new Timer(lifeSpan * 1000);
            m_Timer.AutoReset = false;
            m_Timer.Start();
            m_Timer.Elapsed += m_Timer_Elapsed;
        }
Ejemplo n.º 7
0
 internal void CtcpRequestNotify(IrcUser user, IrcChannel chan, string request, string text)
 {
     if (request.ToUpper() == "DCC" && chan == null)
     {
         Dcc.Handle(user, text);
     }
     if (request.ToUpper() == "ACTION")
     {
         ActionNotify(user, chan, new StringStream(text));
     }
     OnCtcpRequest(user, chan, request, text);
 }
Ejemplo n.º 8
0
 internal void NoticeNotify(IrcUser user, IrcChannel chan, StringStream text)
 {
     if (chan != null)
     {
         chan.NoticeReceivedNotify(user, text);
     }
     OnNotice(user, chan, text);
     if (TriggersCommand(user, chan, text))
     {
         Task.Factory.StartNew(() => m_CommandHandler.Execute(new NoticeCmdTrigger(text, user, chan)));
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Gets the channel with the current name or creates a new Channel object, if it
        /// doesn't exist yet
        /// </summary>
        /// <param name="name">The case-insensitive Channel name.</param>
        /// <returns>The Channel with the corresponding name.</returns>
        public IrcChannel GetOrCreateChannel(string name)
        {
            IrcChannel chan;

            m_me.Channels.TryGetValue(name, out chan);
            if (chan == null)
            {
                chan = new IrcChannel(this, name);
                m_me.Channels.Add(name, chan);
            }
            return(chan);
        }
Ejemplo n.º 10
0
 public AutoVoiceUser(IrcUser user,IrcChannel channel)
 {
     User = user;
     Channel = channel;
     _voiceTimer.Elapsed += delegate
                               {
                                   if(!user.Modes.Contains("v"))
                                   user.IrcClient.CommandHandler.Mode(Channel, "+v", User);
                                   _voiceTimer.Stop();
                               };
     _voiceTimer.Start();
 }
Ejemplo n.º 11
0
        internal void TextNotify(IrcUser user, IrcChannel chan, StringStream text)
        {
            if (chan != null)
            {
                chan.TextNotify(user, text);
            }
            OnText(user, chan, text);

            if (TriggersCommand(user, chan, text))
            {
                m_CommandHandler.Execute(new MsgCmdTrigger(text, user, chan));
            }
        }
Ejemplo n.º 12
0
 internal void JoinNotify(IrcUser user, string name)
 {
     if (!m_loggedIn)
         m_loggedIn = true;
     IrcChannel chan;
     if (user == Me)
     {
         Me.DeleteChannel(name);
     }
     if ((chan = GetChannel(name)) == null)
     {
         Send("mode " + name);
         if (user != m_me)
         {
             foreach (IrcChannel c in m_me)
             {
                 user.AddChannel(c);
                 c.AddUser(user);
                 c.DeleteUser(user);
             }
             m_me = user;
             m_Users.Remove(m_me.Nick);
         }
         chan = new IrcChannel(this, name);
     }
     user.AddChannel(chan);
     chan.UserJoinedNotify(user);
     OnJoin(user, chan);
 }
Ejemplo n.º 13
0
 internal void ModeDeletedNotify(IrcUser user, IrcChannel chan, string mode, string param)
 {
     chan.ModeDeletedNotify(user, mode, param);
     OnModeDeleted(user, chan, mode, param);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Fires when the Client receives the Names list for the specified Channel.
 /// </summary>
 /// <param name="users">An Array of Users who are on the Channel</param>
 protected virtual void OnUsersAdded(IrcChannel chan, IrcUser[] users)
 {
 }
Ejemplo n.º 15
0
 internal void CtcpRequestNotify(IrcUser user, IrcChannel chan, string request, string text)
 {
     if (request.ToUpper() == "DCC" && chan == null)
     {
         Dcc.Handle(user, text);
     }
     OnCtcpRequest(user, chan, request, text);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Fires when the CreationTime of a Channel has been sent (raw 329)
 /// </summary>
 protected virtual void OnChanCreationTime(IrcChannel chan, DateTime creationTime)
 {
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Fires when a User deletes a Channel flag from another User.
 /// </summary>
 protected virtual void OnFlagDeleted(IrcUser user, IrcChannel chan, Privilege priv, IrcUser target)
 {
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Fures when a User deletes a Channel mode.
 /// </summary>
 /// <param name="user">The User who has added the mode</param>
 /// <param name="channel">The channel on which the mode has been changed</param>
 /// <param name="mode">The mode which has been changed</param>
 /// <param name="param">"" if the mode does not have any parameter</param>
 protected virtual void OnModeDeleted(IrcUser user, IrcChannel chan, string mode, string param)
 {
 }
Ejemplo n.º 19
0
 internal void UsersAddedNotify(IrcChannel chan, IrcUser[] users)
 {
     chan.UsersAddedNotify(users);
     OnUsersAdded(chan, users);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Fires when the Topic for a Channel has been sent. Either when joining a Channel or when modified by a User.
 /// </summary>
 protected virtual void OnTopic(IrcUser user, IrcChannel chan, string text, bool initial)
 {
 }
Ejemplo n.º 21
0
 internal void TopicNotify(IrcUser user, IrcChannel chan, string text, bool initial)
 {
     chan.TopicChangedNotify(user, text, initial);
     OnTopic(user, chan, text, initial);
 }
Ejemplo n.º 22
0
 protected virtual void OnCannotJoin(IrcChannel chan, string reason)
 {
 }
Ejemplo n.º 23
0
 internal void CannotJoinNotify(IrcChannel channel, string reason)
 {
     OnCannotJoin(channel, reason);
 }
Ejemplo n.º 24
0
 internal void UsersAddedNotify(IrcChannel chan, IrcUser[] users)
 {
     chan.UsersAddedNotify(users);
     OnUsersAdded(chan, users);
 }
Ejemplo n.º 25
0
 internal void PartNotify(IrcUser user, IrcChannel chan, string reason)
 {
     OnPart(user, chan, reason);
     chan.UserPartedNotify(user, reason);
     user.DeleteChannel(chan.Name);
     CheckUserKnown(user);
 }
Ejemplo n.º 26
0
 internal void ModeDeletedNotify(IrcUser user, IrcChannel chan, string mode, string param)
 {
     chan.ModeDeletedNotify(user, mode, param);
     OnModeDeleted(user, chan, mode, param);
 }
Ejemplo n.º 27
0
 internal void TopicNotify(IrcUser user, IrcChannel chan, string text, bool initial)
 {
     chan.TopicChangedNotify(user, text, initial);
     OnTopic(user, chan, text, initial);
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Fires when a User deletes a Channel flag from another User.
 /// </summary>
 protected virtual void OnFlagDeleted(IrcUser user, IrcChannel chan, Privilege priv, IrcUser target)
 {
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Fires when an already established BanEntry has been sent (raw 367).
 /// </summary>
 protected virtual void OnBanListEntry(IrcChannel chan, BanEntry entry)
 {
 }
Ejemplo n.º 30
0
 internal void FlagDeletedNotify(IrcUser user, IrcChannel chan, Privilege priv, IrcUser target)
 {
     chan.FlagDeletedNotify(user, priv, target);
     OnFlagDeleted(user, chan, priv, target);
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Fires when the Client receives any kind of CTCP reply.
 /// </summary>
 /// <param name="user">The User who sent the text</param>
 /// <param name="channel">The Channel where it was sent (can be null)</param>
 /// <param name="reply">The reply type (such as VERSION)</param>
 /// <param name="args">The text which was sent in addition to the reply</param>
 protected virtual void OnCtcpReply(IrcUser user, IrcChannel chan, string reply, string args)
 {
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Fires when a User is kicked from a Channel.
 /// </summary>
 protected virtual void OnKick(IrcUser from, IrcChannel chan, IrcUser target, string reason)
 {
 }
Ejemplo n.º 33
0
 internal void AddChannel(IrcChannel chan)
 {
     if (!m_comChans.ContainsKey(chan.Name))
         m_comChans.Add(chan.Name, chan);
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Fires when a User parts from a Channel.
 /// </summary>
 protected virtual void OnPart(IrcUser user, IrcChannel chan, string reason)
 {
 }
Ejemplo n.º 35
0
 internal void CtcpReplyNotify(IrcUser user, IrcChannel chan, string reply, string args)
 {
     OnCtcpReply(user, chan, reply, args);
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Fires when the CreationTime of a Channel has been sent (raw 329)
 /// </summary>
 protected virtual void OnChanCreationTime(IrcChannel chan, DateTime creationTime)
 {
 }
Ejemplo n.º 37
0
 internal void FlagDeletedNotify(IrcUser user, IrcChannel chan, Privilege priv, IrcUser target)
 {
     chan.FlagDeletedNotify(user, priv, target);
     OnFlagDeleted(user, chan, priv, target);
 }
Ejemplo n.º 38
0
 internal virtual void ChanCreationTimeNotify(IrcChannel chan, DateTime creationTime)
 {
     chan.ChanCreationTimeSentNotify(creationTime);
     OnChanCreationTime(chan, creationTime);
 }
Ejemplo n.º 39
0
 internal void KickNotify(IrcUser user, IrcChannel chan, IrcUser target, string reason)
 {
     OnKick(user, chan, target, reason);
     chan.UserKickedNotify(user, target, reason);
     target.DeleteChannel(chan.Name);
     CheckUserKnown(target);
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Fires when an already established BanEntry has been sent (raw 367).
 /// </summary>
 protected virtual void OnBanListEntry(IrcChannel chan, BanEntry entry)
 {
 }
Ejemplo n.º 41
0
 internal void NoticeNotify(IrcUser user, IrcChannel chan, StringStream text)
 {
     if (chan != null)
         chan.NoticeReceivedNotify(user, text);
     OnNotice(user, chan, text);
     if (TriggersCommand(user, chan, text))
     {
         m_CommandHandler.ReactTo(new NoticeCmdTrigger(text, user, chan));
     }
 }
Ejemplo n.º 42
0
 internal void BanListEntryNotify(IrcChannel chan, BanEntry entry)
 {
     chan.BanListEntrySentNotify(entry);
     OnBanListEntry(chan, entry);
 }
Ejemplo n.º 43
0
        internal void TextNotify(IrcUser user, IrcChannel chan, StringStream text)
        {
            if (chan != null)
                chan.TextNotify(user, text);
            OnText(user, chan, text);

            if (TriggersCommand(user, chan, text))
            {
                m_CommandHandler.ReactTo(new MsgCmdTrigger(text, user, chan));
            }
        }
Ejemplo n.º 44
0
 /// <summary>
 /// Fires when the BanList for a Channel has been sent completely.
 /// </summary>
 protected virtual void OnBanListComplete(IrcChannel chan)
 {
 }
Ejemplo n.º 45
0
 internal void UserLeftChannelNotify(IrcChannel chan, IrcUser user, string reason)
 {
     OnUserLeftChannel(chan, user, reason);
 }
Ejemplo n.º 46
0
 /// <summary>
 /// Indicates wether or not this User is on the specified channel.
 /// </summary>
 public bool IsOn(IrcChannel chan)
 {
     return(IsOn(chan.Name));
 }
Ejemplo n.º 47
0
 /// <summary>
 /// Fires when the BanList for a Channel has been sent completely.
 /// </summary>
 protected virtual void OnBanListComplete(IrcChannel chan)
 {
 }
Ejemplo n.º 48
0
 internal void CtcpReplyNotify(IrcUser user, IrcChannel chan, string reply, string args)
 {
     OnCtcpReply(user, chan, reply, args);
 }
Ejemplo n.º 49
0
 protected virtual void OnCannotJoin(IrcChannel chan, string reason)
 {
 }
Ejemplo n.º 50
0
 internal void NoticeNotify(IrcUser user, IrcChannel channel, StringStream text)
 {
     OnNotice(user, channel, text);
 }
Ejemplo n.º 51
0
 /// <summary>
 /// Fires when the Client receives a PRIVMSG which was directed to a Channel.
 /// </summary>
 protected virtual void OnChannelMsg(IrcUser user, IrcChannel chan, StringStream text)
 {
 }
Ejemplo n.º 52
0
 internal void CannotJoinNotify(IrcChannel channel, string reason)
 {
     OnCannotJoin(channel, reason);
 }
Ejemplo n.º 53
0
 /// <summary>
 /// Fires when the Client receives any kind of CTCP request. 
 /// Automatically replies to the VERSION request with the content of the Version variable
 /// if not overridden.
 /// </summary>
 /// <param name="user">The User who sent the text</param>
 /// <param name="chan">The Channel where it was sent (can be null)</param>
 /// <param name="request">The request type (such as VERSION)</param>
 /// <param name="args">The text which was sent in addition to the request</param>
 protected virtual void OnCtcpRequest(IrcUser user, IrcChannel chan, string request, string args)
 {
     if (request.ToUpper() == "VERSION" && Version != "")
         CommandHandler.CtcpReply(user.Nick, "VERSION", Version);
 }
Ejemplo n.º 54
0
 internal virtual void ChanCreationTimeNotify(IrcChannel chan, DateTime creationTime)
 {
     chan.ChanCreationTimeSentNotify(creationTime);
     OnChanCreationTime(chan, creationTime);
 }
Ejemplo n.º 55
0
 /// <summary>
 /// Indicates wether or not this User is on the specified channel.
 /// </summary>
 public bool IsOn(IrcChannel chan)
 {
     return IsOn(chan.Name);
 }
Ejemplo n.º 56
0
 internal void ChannelMsgNotify(IrcUser user, IrcChannel chan, StringStream text)
 {
     chan.MsgReceivedNotify(user, text);
     OnChannelMsg(user, chan, text);
 }
Ejemplo n.º 57
0
 internal void BanListCompleteNotify(IrcChannel chan)
 {
     chan.BanListCompleteNotify();
     OnBanListComplete(chan);
 }
Ejemplo n.º 58
0
 /// <summary>
 /// Fires when the specified User joins the specified Channel.
 /// </summary>
 protected virtual void OnJoin(IrcUser user, IrcChannel chan)
 {
 }
Ejemplo n.º 59
0
 protected override void OnJoin(IrcUser user, IrcChannel chan)
 {
     base.OnJoin(user, chan);
     new AutoVoiceUser(user, chan);
 }
Ejemplo n.º 60
0
 /// <summary>
 /// Fires when the Client receives any kind of NOTICE.
 /// </summary>
 /// <param name="user">The User who sent the text</param>
 /// <param name="channel">The Channel where it was sent (can be null)</param>
 /// <param name="text">The text which was sent</param>
 protected virtual void OnNotice(IrcUser user, IrcChannel channel, StringStream text)
 {
 }