I would like a menuitem like "Close unused hubs" that would close all "unused" hubs.
For example:
I'm online on 10 hubs. A, B, C, D...
Downloading from a user that is on hub A
Uploading to a user on hub B
When i use the "Close unused hubs" item, it disconnects from hub C, D... but stays connected on hub A, B.
Is it possible to add a thing like this ?
Close unused hubs feature ?
Moderator: Moderators
I used to commonly do this manually a while ago. "Close disconnected" just wasn't enough for me, because I had to handle so many search requests when in a large amount of connected hubs. Obviously you can't just close every hub and expect that every user will continue to upload files to you, and so getting rid of hubs you didn't make use of seems logical.
I could see how this can be useful.
I could see how this can be useful.
My Visual Studio .NET 2003 is licensed under my name, and the same for my operating system... What about you?
I surf on an OC3 without limitations, two to be exact, and I'm not joking.
I surf on an OC3 without limitations, two to be exact, and I'm not joking.
This is a great idea, I've been thinking about it myself.
Let's try to code it, shall we.
The idea is like this:
If a hub is named in the TranferViews Hub column, some connection (up- or download) is active.
It should be placed just like the "Close disconnected" feature, in the Window menu.
In the file Hubframe.cpp it should look like this:
Here the isActiveHub is a bool which is true when the hub is in the TransferViews Hub column.
Now I'm a bit stuck where and how I should set this isActiveHub to true when a hub is used.
I guess it should be something like:
But in what way are the hub windows named, and where to do this ? In TransferView.h maybe ?
Any help would be appreciated !!
Thanks
Let's try to code it, shall we.
The idea is like this:
If a hub is named in the TranferViews Hub column, some connection (up- or download) is active.
It should be placed just like the "Close disconnected" feature, in the Window menu.
In the file Hubframe.cpp it should look like this:
Code: Select all
void HubFrame::closeAllUnusedHubs() {
for(FrameIter i=frames.begin(); i!= frames.end(); ++i) {
if(!(i->second->isActiveHub)) {
i->second->PostMessage(WM_CLOSE);
}
}
};
Now I'm a bit stuck where and how I should set this isActiveHub to true when a hub is used.
I guess it should be something like:
Code: Select all
if (Util::stricmp(TransferView::COLUMN_HUB, name_of_hub_window)==0)
isActiveHub = true
Any help would be appreciated !!
Thanks
-
- Forum Moderator
- Posts: 366
- Joined: 2004-03-06 02:46
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
You need to add a function that will let you set the value of isActive inside th class you put it in.darwusch wrote:But in what way are the hub windows named, and where to do this ? In TransferView.h maybe ?
To go into DC++, the measure of activity needs to be set and measured in the client project, not using the windows\ (GUI) part of the project. Then the menu item would trigger a call in mainfrm, which would call some function in clientmanager, which would close the clients that weren't active, which would cause the windows to go away.
I have been busy with other things for a while...
Now I would like to finish this feature.
I still don't know exactly where in the clientmanager the isActive should be set however.
The most robust way would be if every hub gets an additional flag, an integer, with the value of how many connections are active on that hub.
Every time a down- or upload starts, the integer gets incremented, and every time a down- or upload finishes, the integer gets decremented.
When closeAllUnusedHubs() is called, all hubs with integer flag == 0, will close.
Can anybody help me with how to add this flag to the hubs, and how / where to add the setting of the integer flag?
I know many people think this feature is not needed or something but it can really be helpful if you're looking for a rare file. Then you connect and disconnect from many hubs, to search for it. But you don't want to disconnect the users that download from you, so you want to keep those active hubs. To do this fast, this feature could help a lot.
Thanks for helping
Now I would like to finish this feature.
I still don't know exactly where in the clientmanager the isActive should be set however.
The most robust way would be if every hub gets an additional flag, an integer, with the value of how many connections are active on that hub.
Every time a down- or upload starts, the integer gets incremented, and every time a down- or upload finishes, the integer gets decremented.
When closeAllUnusedHubs() is called, all hubs with integer flag == 0, will close.
Can anybody help me with how to add this flag to the hubs, and how / where to add the setting of the integer flag?
I know many people think this feature is not needed or something but it can really be helpful if you're looking for a rare file. Then you connect and disconnect from many hubs, to search for it. But you don't want to disconnect the users that download from you, so you want to keep those active hubs. To do this fast, this feature could help a lot.
Thanks for helping