Inheritance: IrcEventArgs
Example #1
0
 void OnNames(object sender, NamesEventArgs e)
 {
     if (ChannelUsers.ContainsKey(e.Data.Channel.ToLower()))
         ChannelUsers.Remove(e.Data.Channel.ToLower());
     var userlist = new List<string>();
     foreach (string s in e.UserList)
         if (!String.IsNullOrEmpty(s.Trim()))
             userlist.Add(s);
     for (int i = 0; i < userlist.Count; i++)
         if (!String.IsNullOrEmpty(userlist[i]))
             if (!Player.IsValidIRCNick(userlist[i]))
                 userlist[i] = Player.ValidIRCNick(userlist[i]);
     ChannelUsers.Add(e.Data.Channel.ToLower(), userlist);
 }
Example #2
0
        private static void OnNames(object sender, NamesEventArgs e) {
            Users.TotalUsers += e.UserList.Count();
            /*uint user_count = 0;
            foreach (string user in new List<string>(e.UserList))
            {
                CreateUser(user, false);
                user_count++;
            }

            Console.WriteLine("We joined, and there are already " + user_count + " users!");*/
        }
Example #3
0
 void OnNames(object sender, NamesEventArgs e)
 {
     names = e.UserList;
 }
 void client_OnNames(object sender, NamesEventArgs e)
 {
     _window.AddUsers(e.UserList, e.Channel);
 }
Example #5
0
 static void client_OnNames(object sender, NamesEventArgs e)
 {
     foreach (string name in e.UserList)
     {
         string nick = char.IsLetter(name[0]) ? name : name.Substring(1);
         User user = TouchUser(nick, true, false);
         if (name[0] == '@') user.Meta.JTVModerator = true;
     }
 }
Example #6
0
		void OnNames(object sender, NamesEventArgs e)
		{
			SetStatus("Connected!");
			if(OpList != null)
			{
				OpList.Clear();
			}
			else
			{
				if(OpList == null) OpList = new Dictionary<string, string>();
			}

			foreach (string user in e.UserList)
			{
				if(user.StartsWith("@") || user.StartsWith("&") || user.StartsWith("~"))
				{

					OpList.Add(user.Substring(1), "");
				}
			}
		}
Example #7
0
 void mClient_OnNames(object sender, NamesEventArgs e)
 {
     UpdateNames();
 }
Example #8
0
        private void _OnNames(object sender, NamesEventArgs e)
        {
            #if LOG4NET
            // logging noise
            //_Logger.Debug("_OnNames() e.Channel: " + e.Channel);
            #endif
            GroupChatModel groupChat = (GroupChatModel) GetChat(e.Data.Channel, ChatType.Group);
            if (groupChat != null && groupChat.IsSynced) {
                // nothing todo for us
                return;
            }

            // would be nice if SmartIrc4net would take care of removing prefixes
            foreach (string user in e.UserList) {
                // skip empty users (some IRC servers send an extra space)
                if (user.TrimEnd(' ').Length == 0) {
                    continue;
                }
                string username = user;

                switch (user[0]) {
                    case '@':
                    case '+':
                    // RFC VIOLATION
                    // some IRC network do this and break our nice smuxi...
                    case '&':
                    case '%':
                    case '~':
                        username = user.Substring(1);
                        break;
                }

                var groupPerson = CreateGroupPerson(username);

                groupChat.UnsafePersons.Add(groupPerson.NickName.ToLower(), groupPerson);
            #if LOG4NET
                // logging noise
                //_Logger.Debug("_OnNames() added user: " + username + " to: " + groupChat.Name);
            #endif
            }
        }
Example #9
0
        /// <summary>
        /// Handles the IRC OnNames event.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">EventArgs.</param>
        void OnNames(object sender, NamesEventArgs e)
        {
            if (label25.Text == "Logging In...") // we don't want to overwrite the Topic thingy on connect!
                SetStatus("Connected!");
            if (OpList != null)
            {
                OpList.Clear();
            }
            else
            {
                OpList = new Dictionary<string, string>();
            }

            foreach (string user in e.UserList)
            {
                if (user.StartsWith("@") || user.StartsWith("&") || user.StartsWith("~"))
                {
                    OpList.Add(user.Substring(1), "");
                }
            }
        }
Example #10
0
 void IRC_OnNames(object sender, NamesEventArgs e)
 {
     if (e.Channel != Channel) return;
     UpdateUsers();
 }
Example #11
0
        private void OnNames(object sender, NamesEventArgs e)
        {
            //Got the list of everybody...
            if (OpList != null)
            {
                OpList.Clear();
            }
            else
            {
                if (OpList == null) OpList = new HashSet<string>();
            }

            foreach (string user in e.UserList)
            {
                if (user.StartsWith("@") || user.StartsWith("&") || user.StartsWith("~"))
                {
                    //Add operators to our operator set.
                    OpList.Add(user.Substring(1));
                }
            }
        }
Example #12
0
		void ClientNames(NamesEventArgs e)
		{
			var channel = Server.Channel(e.Channel);
			if (channel != null)
			{
				foreach (string user in e.UserList)
				{
					var bot = channel.Bot(Regex.Replace(user, "^(@|!|%|\\+){1}", ""));
					if (bot != null)
					{
						bot.Connected = true;
						bot.LastMessage = "joined channel " + channel.Name;
						if (bot.State != Bot.States.Active)
						{
							bot.State = Bot.States.Idle;
						}
						bot.Commit();
						OnBotJoined(this, new EventArgs<Bot>(bot));
					}
					else
					{
						OnUserJoined(this, new EventArgs<Model.Domain.Channel, string>(channel, user));
					}
				}
				UpdateChannel(channel);
			}
		}
Example #13
0
		void ClientOnNames(object sender, NamesEventArgs e)
		{
			_events.Enqueue(new IrcEvent { Type = IrcEvent.EventType.Names, Event = e });
			_waitHandle.Set();
		}