There must be a way for my script to read the number of slots and available slots since when i search with my client i can see how many slots are available.
Any ideas? I see the bot azatht is working on gets it info from the description of the dc++ client. That wont help me since most of my users use the dcgui client.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't think of any way, no. The only DC command which includes the number of free slots is the search reply (and the hub only sees this if the searcher is in passive mode).
I suppose it may be possible for the hub to send out a passive search request and collect in the responses. You'd need to search for something everyone has though (and that the clients won't ignore). Even then you can't be sure of getting responses from everyone as clients can be too busy to respond to all search requests.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
$verdata = substr($tmpdata, $pos1, $pos2 - $pos1);
my(@verdata2) = split(/\ /, $verdata); <-- Here I split the description-tag, it's only one free-space there, so index zero is the client
There must be a way for my script to read the number of slots and available slots since when i search with my client i can see how many slots are available.
Any ideas? I see the bot azatht is working on gets it info from the description of the dc++ client. That wont help me since most of my users use the dcgui client.
I can't think of any way, no. The only DC command which includes the number of free slots is the search reply (and the hub only sees this if the searcher is in passive mode).
I suppose it may be possible for the hub to send out a passive search request and collect in the responses. You'd need to search for something everyone has though (and that the clients won't ignore). Even then you can't be sure of getting responses from everyone as clients can be too busy to respond to all search requests.
imerlin, if you look at my script, it handels dcgui also.
sub split_description() {
my($user) = @_;
my($tmpdata) = odch::get_description($user);
odch::data_to_all("<debug> $tmpdata|");
my($pos1) = rindex($tmpdata, "<") +1;
my($pos2) = rindex($tmpdata, ">");
$verdata = substr($tmpdata, $pos1, $pos2 - $pos1);
my(@verdata2) = split(/\ /, $verdata); <-- Here I split the description-tag, it's only one free-space there, so index zero is the client
my($pos1) = rindex($tmpdata, "<@verdata2[0]") + length(@verdata2[0]);
$tmpdata = substr($tmpdata, $pos1, $pos2 - $pos1);
my(@tmpdata) = split(/,/, $tmpdata);
$dcClient = @verdata2[0];
$dcVersion = (split(/:/, $tmpdata[0]))[1];
$ModeAP = (split(/:/, $tmpdata[1]))[1];
$NbHubs = (split(/:/, $tmpdata[2]))[1];
$NSlots = (split(/:/, $tmpdata[3]))[1];
$UploadLimit = (split(/:/, $tmpdata[4]))[1];
}
Sorry azatht, I was looking at a rather old version of your script.
I just dont think parsing the descrption field is a relyable way to find out how many slots.
But ofcourse we can kick users if they dont have the description field on.
Thanks for the input guys.