mirror of
https://github.com/mirror/jdownloader.git
synced 2025-03-04 18:38:24 +00:00
git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@5911 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
parent
000492afe6
commit
76d697ed88
@ -322,7 +322,11 @@ public class AccountController extends SubConfiguration implements ActionListene
|
||||
}
|
||||
|
||||
public Account getValidAccount(PluginForHost pluginForHost) {
|
||||
if (!JDUtilities.getConfiguration().getBooleanProperty(Configuration.PARAM_USE_GLOBAL_PREMIUM, true)) return null;
|
||||
|
||||
if (!JDUtilities.getConfiguration().getBooleanProperty(Configuration.PARAM_USE_GLOBAL_PREMIUM, true)){
|
||||
logger.finest("Premium globally disabled") ;
|
||||
return null;
|
||||
}
|
||||
synchronized (hosteraccounts) {
|
||||
ArrayList<Account> accounts = new ArrayList<Account>();
|
||||
accounts.addAll(provider.collectAccountsFor(pluginForHost));
|
||||
@ -332,6 +336,7 @@ public class AccountController extends SubConfiguration implements ActionListene
|
||||
for (int i = 0; i < accounts.size(); i++) {
|
||||
Account next = accounts.get(i);
|
||||
if (!next.isTempDisabled() && next.isEnabled()) {
|
||||
logger.finest("Found account "+next.getUser()) ;
|
||||
if (!this.broadcaster.fireEvent(new AccountControllerEvent(this, AccountControllerEvent.ACCOUNT_GET, pluginForHost.getHost(), next))) {
|
||||
ret = next;
|
||||
break;
|
||||
@ -339,6 +344,9 @@ public class AccountController extends SubConfiguration implements ActionListene
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ret==null){
|
||||
logger.finest("No Account found") ;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,15 @@ public class Account extends Property {
|
||||
}
|
||||
|
||||
public boolean isTempDisabled() {
|
||||
if (tempDisabled && (System.currentTimeMillis() - tmpDisabledTime) > this.getTmpDisabledInterval()) tempDisabled = false;
|
||||
logger.finest(user + " tempDisabled: " + tempDisabled);
|
||||
logger.finest(user + " tmpDisabledTime: " + tmpDisabledTime + " " + (System.currentTimeMillis() - tmpDisabledTime) + ">" + getTmpDisabledInterval());
|
||||
if (!tempDisabled) {
|
||||
logger.finest(user + " ret: " + tempDisabled);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((System.currentTimeMillis() - tmpDisabledTime) > this.getTmpDisabledInterval()) tempDisabled = false;
|
||||
logger.finest(user + " ret: " + tempDisabled);
|
||||
return tempDisabled;
|
||||
}
|
||||
|
||||
@ -85,8 +93,13 @@ public class Account extends Property {
|
||||
}
|
||||
|
||||
public void setTempDisabled(boolean tempDisabled) {
|
||||
if (this.tempDisabled == tempDisabled) return;
|
||||
this.tmpDisabledTime = System.currentTimeMillis();
|
||||
if (tempDisabled) {
|
||||
logger.finest("Account " + user + " disabled for " + tmpDisabledInterval + "ms");
|
||||
} else {
|
||||
logger.finest("Account " + user + " free to use");
|
||||
}
|
||||
if (this.tempDisabled == tempDisabled) return;
|
||||
this.tempDisabled = tempDisabled;
|
||||
}
|
||||
|
||||
|
@ -558,7 +558,7 @@ public class Rapidshare extends PluginForHost {
|
||||
}
|
||||
|
||||
}
|
||||
if(true) throw new PluginException(LinkStatus.ERROR_PREMIUM, "TEST", LinkStatus.VALUE_ID_PREMIUM_TEMP_DISABLE);
|
||||
if(false) throw new PluginException(LinkStatus.ERROR_PREMIUM, "TEST", LinkStatus.VALUE_ID_PREMIUM_TEMP_DISABLE);
|
||||
if (downloadLink.getLinkType() == DownloadLink.LINKTYPE_CONTAINER) {
|
||||
if (Sniffy.hasSniffer()) throw new SnifferException();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user