Java Code Examples for org.telegram.messenger.SharedConfig#ProxyInfo

The following examples show how to use org.telegram.messenger.SharedConfig#ProxyInfo . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProxyListActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void checkProxyList() {
    for (int a = 0, count = SharedConfig.proxyList.size(); a < count; a++) {
        final SharedConfig.ProxyInfo proxyInfo = SharedConfig.proxyList.get(a);
        if (proxyInfo.checking || SystemClock.elapsedRealtime() - proxyInfo.availableCheckTime < 2 * 60 * 1000) {
            continue;
        }
        proxyInfo.checking = true;
        proxyInfo.proxyCheckPingId = ConnectionsManager.getInstance(currentAccount).checkProxy(proxyInfo.address, proxyInfo.port, proxyInfo.username, proxyInfo.password, proxyInfo.secret, time -> AndroidUtilities.runOnUIThread(() -> {
            proxyInfo.availableCheckTime = SystemClock.elapsedRealtime();
            proxyInfo.checking = false;
            if (time == -1) {
                proxyInfo.available = false;
                proxyInfo.ping = 0;
            } else {
                proxyInfo.ping = time;
                proxyInfo.available = true;
            }
            NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxyCheckDone, proxyInfo);
        }));
    }
}
 
Example 2
Source File: ProxyListActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void checkProxyList() {
    for (int a = 0, count = SharedConfig.proxyList.size(); a < count; a++) {
        final SharedConfig.ProxyInfo proxyInfo = SharedConfig.proxyList.get(a);
        if (proxyInfo.checking || SystemClock.elapsedRealtime() - proxyInfo.availableCheckTime < 2 * 60 * 1000) {
            continue;
        }
        proxyInfo.checking = true;
        proxyInfo.proxyCheckPingId = ConnectionsManager.getInstance(currentAccount).checkProxy(proxyInfo.address, proxyInfo.port, proxyInfo.username, proxyInfo.password, proxyInfo.secret, time -> AndroidUtilities.runOnUIThread(() -> {
            proxyInfo.availableCheckTime = SystemClock.elapsedRealtime();
            proxyInfo.checking = false;
            if (time == -1) {
                proxyInfo.available = false;
                proxyInfo.ping = 0;
            } else {
                proxyInfo.ping = time;
                proxyInfo.available = true;
            }
            NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxyCheckDone, proxyInfo);
        }));
    }
}
 
Example 3
Source File: ProxyListActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void checkProxyList()
{
    for (int a = 0, count = SharedConfig.proxyList.size(); a < count; a++)
    {
        final SharedConfig.ProxyInfo proxyInfo = SharedConfig.proxyList.get(a);
        if (proxyInfo.checking || SystemClock.elapsedRealtime() - proxyInfo.availableCheckTime < 2 * 60 * 1000)
        {
            continue;
        }
        proxyInfo.checking = true;
        proxyInfo.proxyCheckPingId = ConnectionsManager.getInstance(currentAccount).checkProxy(proxyInfo.address, proxyInfo.port, proxyInfo.username, proxyInfo.password, proxyInfo.secret, time -> AndroidUtilities.runOnUIThread(() ->
        {
            proxyInfo.availableCheckTime = SystemClock.elapsedRealtime();
            proxyInfo.checking = false;
            if (time == -1)
            {
                proxyInfo.available = false;
                proxyInfo.ping = 0;
            }
            else
            {
                proxyInfo.ping = time;
                proxyInfo.available = true;
            }
            NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxyCheckDone, proxyInfo);
        }));
    }
}
 
Example 4
Source File: ProxyListActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void checkProxyList()
{
    for (int a = 0, count = SharedConfig.proxyList.size(); a < count; a++)
    {
        final SharedConfig.ProxyInfo proxyInfo = SharedConfig.proxyList.get(a);
        if (proxyInfo.checking || SystemClock.elapsedRealtime() - proxyInfo.availableCheckTime < 2 * 60 * 1000)
        {
            continue;
        }
        proxyInfo.checking = true;
        proxyInfo.proxyCheckPingId = ConnectionsManager.getInstance(currentAccount).checkProxy(proxyInfo.address, proxyInfo.port, proxyInfo.username, proxyInfo.password, proxyInfo.secret, time -> AndroidUtilities.runOnUIThread(() ->
        {
            proxyInfo.availableCheckTime = SystemClock.elapsedRealtime();
            proxyInfo.checking = false;
            if (time == -1)
            {
                proxyInfo.available = false;
                proxyInfo.ping = 0;
            }
            else
            {
                proxyInfo.ping = time;
                proxyInfo.available = true;
            }
            NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxyCheckDone, proxyInfo);
        }));
    }
}
 
Example 5
Source File: ProxySettingsActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public ProxySettingsActivity()
{
    super();
    currentProxyInfo = new SharedConfig.ProxyInfo("", 1080, "", "", "");
    addingNewProxy = true;
}
 
Example 6
Source File: ProxySettingsActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public ProxySettingsActivity(SharedConfig.ProxyInfo proxyInfo)
{
    super();
    currentProxyInfo = proxyInfo;
    currentType = TextUtils.isEmpty(proxyInfo.secret) ? 0 : 1;
}
 
Example 7
Source File: ProxyListActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public void setProxy(SharedConfig.ProxyInfo proxyInfo)
{
    textView.setText(proxyInfo.address + ":" + proxyInfo.port);
    currentInfo = proxyInfo;
    updateStatus();
}
 
Example 8
Source File: ProxySettingsActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public ProxySettingsActivity()
{
    super();
    currentProxyInfo = new SharedConfig.ProxyInfo("", 1080, "", "", "");
    addingNewProxy = true;
}
 
Example 9
Source File: ProxySettingsActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public ProxySettingsActivity(SharedConfig.ProxyInfo proxyInfo)
{
    super();
    currentProxyInfo = proxyInfo;
    currentType = TextUtils.isEmpty(proxyInfo.secret) ? 0 : 1;
}
 
Example 10
Source File: ProxyListActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public void setProxy(SharedConfig.ProxyInfo proxyInfo)
{
    textView.setText(proxyInfo.address + ":" + proxyInfo.port);
    currentInfo = proxyInfo;
    updateStatus();
}
 
Example 11
Source File: ProxySettingsActivity.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public ProxySettingsActivity() {
    super();
    currentProxyInfo = new SharedConfig.ProxyInfo("", 1080, "", "", "");
    addingNewProxy = true;
}
 
Example 12
Source File: ProxySettingsActivity.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public ProxySettingsActivity(SharedConfig.ProxyInfo proxyInfo) {
    super();
    currentProxyInfo = proxyInfo;
}
 
Example 13
Source File: ProxyListActivity.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public void setProxy(SharedConfig.ProxyInfo proxyInfo) {
    textView.setText(proxyInfo.address + ":" + proxyInfo.port);
    currentInfo = proxyInfo;
}
 
Example 14
Source File: ProxySettingsActivity.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public ProxySettingsActivity() {
    super();
    currentProxyInfo = new SharedConfig.ProxyInfo("", 1080, "", "", "");
    addingNewProxy = true;
}
 
Example 15
Source File: ProxySettingsActivity.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public ProxySettingsActivity(SharedConfig.ProxyInfo proxyInfo) {
    super();
    currentProxyInfo = proxyInfo;
}
 
Example 16
Source File: ProxyListActivity.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public void setProxy(SharedConfig.ProxyInfo proxyInfo) {
    textView.setText(proxyInfo.address + ":" + proxyInfo.port);
    currentInfo = proxyInfo;
}