Пример #1
0
 /// <summary>
 ///     Constructor for arguments class passed to the UserInvitedToChannel event
 /// </summary>
 /// <param name="server">IServer</param>
 /// <param name="channelName">string</param>
 /// <param name="user">IChannelUser</param>
 /// <param name="eatData">EatData</param>
 public UserInvitedToChannelArgs(IServer server, string channelName, IChannelUser user, EatData eatData)
 {
     this.server      = server;
     this.channelName = channelName;
     this.user        = user;
     this.eatData     = eatData;
 }
Пример #2
0
        /// <summary>
        /// Kicks a user with given user from this channel.
        /// </summary>
        ///
        /// <param name="channel">The channel to act on.</param>
        /// <param name="user">   The user.</param>
        public static void Kick(this IChannel channel, IUser user)
        {
            IClientConnection connection  = channel.Connection;
            IChannelUser      channelUser = channel.GetUser(user.Name);

            connection.SendAndForget(connection.MessageSender.Kick(channelUser));
        }
Пример #3
0
        /// <summary>
        /// Kicks a user with given user name from this channel with a reason.
        /// </summary>
        ///
        /// <param name="channel"> The channel to act on.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="reason">  The reason.</param>
        public static void Kick(this IChannel channel, String userName, String reason)
        {
            IClientConnection connection  = channel.Connection;
            IChannelUser      channelUser = channel.GetUser(userName);

            connection.SendAndForget(connection.MessageSender.Kick(channelUser, reason));
        }
Пример #4
0
 /// <summary>
 ///     Constructor for arguments class passed to the ChannelJoin event
 /// </summary>
 /// <param name="channel">IChannel</param>
 /// <param name="user">IChannelUser</param>
 /// <param name="rawMessage">string</param>
 /// <param name="rawBytes">string</param>
 /// <param name="serverTime">DateTime</param>
 /// <param name="messageTags">IDictionary></param>
 /// <param name="eatData">EatData></param>
 public ChannelJoinArgs(IChannel channel, IChannelUser user, string rawMessage, string rawBytes, DateTime serverTime, IDictionary <string, string> messageTags, EatData eatData)
 {
     this.channel     = channel;
     this.user        = user;
     this.rawMessage  = rawMessage;
     this.rawBytes    = rawBytes;
     this.serverTime  = serverTime;
     this.messageTags = messageTags;
     this.eatData     = eatData;
 }
Пример #5
0
        public int CompareTo(IChannelUser other)
        {
            if(ReferenceEquals(other, null))
                return 1;

            int result = 0;
            result = this.Channel.CompareTo(other.Channel);
            if(result == 0)
                result = this.User.CompareTo(other.User);
            return result;
        }
Пример #6
0
 /// <summary>
 ///     Constructor for arguments class passed to the ChannelKick event
 /// </summary>
 /// <param name="channel">IChannel</param>
 /// <param name="kickedUser">IChannelUser</param>
 /// <param name="byUser">IChannelUser</param>
 /// <param name="kickReason">string</param>
 /// <param name="rawMessage">string</param>
 /// <param name="rawBytes">string</param>
 /// <param name="serverTime">DateTime</param>
 /// <param name="messageTags">IDictionary></param>
 /// <param name="eatData">EatData></param>
 public ChannelKickArgs(IChannel channel, IChannelUser kickedUser, IChannelUser byUser, string kickReason, string rawMessage, string rawBytes, DateTime serverTime, IDictionary <string, string> messageTags, EatData eatData)
 {
     this.channel     = channel;
     this.kickedUser  = kickedUser;
     this.byUser      = byUser;
     this.kickReason  = kickReason;
     this.rawMessage  = rawMessage;
     this.rawBytes    = rawBytes;
     this.serverTime  = serverTime;
     this.messageTags = messageTags;
     this.eatData     = eatData;
 }
 /// <summary>
 ///     Constructor for arguments class passed to the ChannelServerModeUserDehalfOpped event
 /// </summary>
 /// <param name="channel">IChannel</param>
 /// <param name="user">IChannelUser</param>
 /// <param name="modeFirst">bool</param>
 /// <param name="modeLast">bool</param>
 /// <param name="rawMessage">string</param>
 /// <param name="rawBytes">string</param>
 /// <param name="serverTime">DateTime</param>
 /// <param name="messageTags">IDictionary></param>
 /// <param name="eatData">EatData></param>
 public ChannelServerModeUserDehalfOppedArgs(IChannel channel, IChannelUser user, bool modeFirst, bool modeLast, string rawMessage, string rawBytes, DateTime serverTime, IDictionary <string, string> messageTags, EatData eatData)
 {
     this.channel     = channel;
     this.user        = user;
     this.modeFirst   = modeFirst;
     this.modeLast    = modeLast;
     this.rawMessage  = rawMessage;
     this.rawBytes    = rawBytes;
     this.serverTime  = serverTime;
     this.messageTags = messageTags;
     this.eatData     = eatData;
 }
Пример #8
0
        public bool Equals(IChannelUser other)
        {
            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            return
                (EqualityComparer <IChannel> .Default.Equals(this.Channel, other.Channel) &&
                 EqualityComparer <IUser> .Default.Equals(this.User, other.User)
                );
        }
Пример #9
0
        public int CompareTo(IChannelUser other)
        {
            if (ReferenceEquals(other, null))
            {
                return(1);
            }

            int result = 0;

            result = this.Channel.CompareTo(other.Channel);
            if (result == 0)
            {
                result = this.User.CompareTo(other.User);
            }
            return(result);
        }
Пример #10
0
        internal void ChangeName(String oldNickname, String newNickname)
        {
            if (ContainsUser(newNickname))
            {
                _logger.Error("Changing nickname " + oldNickname + " into " + newNickname +
                              ", but a channel user with that nickname already exists. Some observable subscriptions may be lost.");

                _users.Remove(oldNickname);
                _knownUsers.Remove(oldNickname);
                return;
            }

            IChannelUser channelUser = _users[oldNickname];

            _users.ChangeItemKey(channelUser, newNickname);
            _knownUsers.ChangeItemKey(channelUser, newNickname);
        }
Пример #11
0
        private IReceiveMessage ParseKickMessage(IMessageTarget sender, String line)
        {
            Match results = KickRegex.Match(line);

            if (results.Success && results.Groups[1].Success && results.Groups[2].Success)
            {
                String channelName = results.Groups[1].Value;
                String userName    = results.Groups[2].Value;
                String message     = String.Empty;
                if (results.Groups[3].Success)
                {
                    message = results.Groups[3].Value;
                }
                IChannel     channel     = Connection.GetChannel(channelName);
                IChannelUser channelUser = channel.GetUser(userName);

                return(Client.CreateReceiveMessage(Connection, message, DateTime.Now, sender, channelUser,
                                                   ReceiveType.Kick, ReplyType.Unknown));
            }
            return(null);
        }
 /// <summary>
 /// Query if the user has owner in this channel.
 /// </summary>
 ///
 /// <param name="channelUser">The channel user to act on.</param>
 ///
 /// <returns>
 /// True if user has owner, false if not.
 /// </returns>
 public static bool HasOwner(this IChannelUser channelUser)
 {
     return((ChannelUserMode.ModeFlags(channelUser.Modes) & ChannelUserModeType.Owner) ==
            ChannelUserModeType.Owner);
 }
 /// <summary>
 /// Query if the user has protected in this channel.
 /// </summary>
 ///
 /// <param name="channelUser">The channel user to act on.</param>
 ///
 /// <returns>
 /// True if user has protected, false if not.
 /// </returns>
 public static bool HasProtected(this IChannelUser channelUser)
 {
     return((ChannelUserMode.ModeFlags(channelUser.Modes) & ChannelUserModeType.Protected) ==
            ChannelUserModeType.Protected);
 }
 /// <summary>
 /// Query if the user has halfop in this channel.
 /// </summary>
 ///
 /// <param name="channelUser">The channel user to act on.</param>
 ///
 /// <returns>
 /// True if user has halfop, false if not.
 /// </returns>
 public static bool HasHalfOp(this IChannelUser channelUser)
 {
     return((ChannelUserMode.ModeFlags(channelUser.Modes) & ChannelUserModeType.HalfOp) ==
            ChannelUserModeType.HalfOp);
 }
Пример #15
0
 public ISendMessage Kick(IChannelUser channelUser, String comment)
 {
     return Client.CreateSendMessage(Connection, "KICK ", String.Concat(channelUser.Channel.Name, " "
        , channelUser.User.Name, " :", comment), String.Empty, SendType.Kick, channelUser);
 }
 /// <summary>
 /// Query if the user has no modes in this channel.
 /// </summary>
 ///
 /// <param name="channelUser">The channel user to act on.</param>
 ///
 /// <returns>
 /// True if the user has no modes in this channel, false if not.
 /// </returns>
 public static bool HasNone(this IChannelUser channelUser)
 {
     return(ChannelUserMode.ModeFlags(channelUser.Modes) == 0);
 }
Пример #17
0
 public ISendMessage Kick(IChannelUser channelUser, String comment)
 {
     return Client.CreateSendMessage(Connection, "KICK ", String.Concat(channelUser.Channel.Name, " "
        , channelUser.User.Name, " :", comment), String.Empty, SendType.Kick, channelUser);
 }
Пример #18
0
 public static void Kick(IContext context, IChannelUser user)
 {
     user.Kick();
 }
 public static void Op(this IChannelUser channelUser)
 {
     channelUser.Channel.SetUserMode(channelUser.User.Name,
                                     Mode.AddChar.ToString() + ChannelUserMode.OpMode);
 }
        /// <summary>
        /// Kicks this user on this channel with a reason.
        /// </summary>
        ///
        /// <param name="channelUser">The channel user to act on.</param>
        /// <param name="reason">    The reason.</param>
        public static void Kick(this IChannelUser channelUser, String reason)
        {
            IClientConnection connection = channelUser.Connection;

            connection.SendAndForget(connection.MessageSender.Kick(channelUser, reason));
        }
 /// <summary>
 /// Gets the highest mode this user has on this channel.
 /// </summary>
 ///
 /// <param name="channelUser">The channel user to act on.</param>
 public static ChannelUserModeType HighestUserMode(this IChannelUser channelUser)
 {
     return(ChannelUserMode.HighestMode(channelUser.Modes));
 }
 /// <summary>
 /// Query if the user has voice in this channel.
 /// </summary>
 ///
 /// <param name="channelUser">The channel user to act on.</param>
 ///
 /// <returns>
 /// True if user has voice, false if not.
 /// </returns>
 public static bool HasVoice(this IChannelUser channelUser)
 {
     return((ChannelUserMode.ModeFlags(channelUser.Modes) & ChannelUserModeType.Voice) ==
            ChannelUserModeType.Voice);
 }
 public static void DeProtect(this IChannelUser channelUser)
 {
     channelUser.Channel.SetUserMode(channelUser.User.Name,
                                     Mode.RemoveChar.ToString() + ChannelUserMode.ProtectedMode);
 }
Пример #24
0
 public static void Kick(IContext context, IChannelUser user, String reason)
 {
     user.Kick(reason);
 }
 public static void DeOwner(this IChannelUser channelUser)
 {
     channelUser.Channel.SetUserMode(channelUser.User.Name,
                                     Mode.RemoveChar.ToString() + ChannelUserMode.OwnerMode);
 }
Пример #26
0
        public bool Equals(IChannelUser other)
        {
            if(ReferenceEquals(other, null))
                return false;

            return
                EqualityComparer<IChannel>.Default.Equals(this.Channel, other.Channel)
             && EqualityComparer<IUser>.Default.Equals(this.User, other.User)
             ;
        }