IRC - populating a userlist

GrenadeFX

Newcomer
Joined
Jan 20, 2005
Messages
21
Location
Australia
ok i can connect to irc servers but i have no clue how to get a userlist. I have no special irc control or anything so i have to get a userlist from raw data and i know how to get a userlist from teh server but i do not know how to seperate the names and stick them into another textbox

please help
 
GrenadeFX said:
ok i can connect to irc servers but i have no clue how to get a userlist. I have no special irc control or anything so i have to get a userlist from raw data and i know how to get a userlist from teh server but i do not know how to seperate the names and stick them into another textbox

please help

You could probably use a regular expression to parse it for you. why don't you put up a sample userlist in raw form for us.
 
ok sure here we go
the server sends the client this stuff
<NAMES <NAMES Chan:#Aeonofstrife.net> change_this_to_your_nick +DarkSt0rm +lor00 @Sephiroth @Aos-Bot> change_this_to_your_nick +DarkSt0rm +lor00 @Sephiroth @Aos-Bot
so i guess i want it when it recognises <NAMES> (not <<NAMES Chan:#Aeonofstrife.net>) i want it to put all hte users it displays into my listbox the users are seperated by a space ...
hope this helps a bit
 
ok, I am not good with regular expressions, so here is the code I came up with...

[CS]
string[] a;
string b;
t1.Text = string.Empty;
t2.Text = string.Empty;

t1.Text = "<NAMES <NAMES Chan:#Aeonofstrife.net> change_this_to_your_nick +DarkSt0rm +lor00 @Sephiroth @Aos-Bot> change_this_to_your_nick>";

b = t1.Text;
a = b.Split(' ');
a[a.Length-2] = a[a.Length-2].Substring(0,a[a.Length-2].Length - 1);

for (int i = 3; i<a.Length-1; i++)
{
t2.Text += a.ToString() + "|";
}
[/CS]

a in the for statement will give you each user that is connected.
 
ok i dont know much bout vb.net say alone C# so if i could get sumone to translate into vb.net compatable code would be really apreciated

soz coldfusion244 but im just not advanced enought to integrate it into vb.net
 
with regexp :

Code:
        private Regex _UserInChan = new Regex("(:.*?) 353 (.*?) #skyclient :(?<users>.*$)", RegexOptions.Compiled);


            else if (_UserInChan.IsMatch(input))
            {
                match = _UserInChan.Match(inputLine);
                usersLine = match.Groups["users"].ToString();

                string[] split = usersLine.Split(' ');
                foreach (string user in split)
                {
                    if (user.Length <= 5)
                    {
                        //
                    }
                    else
                    {
                        item = new ListViewItem(new string[] { user, user.Substring(user.IndexOf('|') + 4) }, -1);
                        MainForm.AddUserInList(item);
                    }
                    item = null;
                }

                Thread.Sleep(1000);
            }
 
Back
Top