Is there a Constant Number of Channels for ALL Clients?
Probably not. If your question is because you're wondering how to parse it, you just need to keep reading strings out of your packet until you find a double null, since the channel list is terminated by a double null.
psuedocode
OnGetChannelList(BncsPacket p)
{
list<string> channels;
string current_channel;
while(p.PeekWord() != 0)
{
current_channel = p.ReadString();
channels.add(current_channel);
}
}
Quote from: BaDDBLooD on August 24, 2004, 08:53 PM
Is there a Constant Number of Channels for ALL Clients?
No. I assume you're asking this because you don't know how to grab each channel name in a SID_GETCHANNELLIST response?
Each channel is null-terminated. To handle this in VB it's easy. Let's say
s is your data (not including the header):
Dim a As Long, b
b = Split(s, vbNullChar)
For a = LBound(b) To UBound(b) - 1 ' ignore last empty null
' b(a) is the next channel
Next aThat is simply splitting the data by each null so you can read channel. That is one way which is probably the easiest to explain/understand. Others can post other methods if they so desire.
I was wondering how i am going to add these into a Menu.
EDIT: I already have the code to parse 0x0B, thanks though.
Quote from: BaDDBLooD on August 24, 2004, 09:16 PM
I was wondering how i am going to add these into a Menu.
EDIT: I already have the code to parse 0x0B, thanks though.
I know you're using .NET. Here's some pseudo-code:
You have the menu (such as Channels) you want -- since the Channels menu is of type MenuItem, let's call it miChannels.
For Each s As String in ListOfChannels
' Create new MenuItem using constructor
' Set the MenuItem.Click event handler on that item instance.
miChannels.MenuItems.Add(myNewMenuItem)
Next
Except for.. i'm not using .NET Cause i could never get my .NET Bot to work! Yeah, that's right!
EDIT: I am using VB6, i WISH I Could use .NET
Quote from: BaDDBLooD on August 24, 2004, 09:16 PM
I was wondering how i am going to add these into a Menu.
EDIT: I already have the code to parse 0x0B, thanks though.
Then you asked your question VERY badly. Maybe start a thread in the "X Programming forum" for "Adding items to a menu"?
My original topic was is the number of channels static, it got off topic.