diff --git a/src/apps/bin/ppp_up/ConnectionView.cpp b/src/apps/bin/ppp_up/ConnectionView.cpp index 3572c402b4..309f43665a 100644 --- a/src/apps/bin/ppp_up/ConnectionView.cpp +++ b/src/apps/bin/ppp_up/ConnectionView.cpp @@ -159,8 +159,8 @@ ConnectionView::AttachedToWindow() fCancelButton->SetTarget(this); fSettings.LoadSettings(fInterfaceName.String(), false); - if(fAddon->CountAuthenticators() == 0 || fAddon->HasPassword()) - // TODO: || AskBeforeDialing == true + if(fAddon->CountAuthenticators() == 0 || fAddon->HasPassword() + || fAddon->AskBeforeConnecting()) Connect(); } @@ -256,8 +256,8 @@ ConnectionView::Cancel() interface->GetInterfaceInfo(&info); if(info.info.phase < PPP_ESTABLISHED_PHASE) { - thread_id down = spawn_thread(down_thread, "up_thread", B_NORMAL_PRIORITY, - interface); + thread_id down = spawn_thread(down_thread, "down_thread", + B_NORMAL_PRIORITY, interface); resume_thread(down); } else delete interface; @@ -282,8 +282,8 @@ ConnectionView::AttemptString() const ppp_interface_info_t info; interface.GetInterfaceInfo(&info); BString attempt; - attempt << "Attempt " << info.info.dialRetry << " of " << - info.info.dialRetriesLimit; + attempt << "Attempt " << info.info.connectRetry << " of " << + info.info.connectRetriesLimit; return attempt; } diff --git a/src/apps/bin/ppp_up/PPPUpAddon.cpp b/src/apps/bin/ppp_up/PPPUpAddon.cpp index bfb4358e5b..bee8c3d190 100644 --- a/src/apps/bin/ppp_up/PPPUpAddon.cpp +++ b/src/apps/bin/ppp_up/PPPUpAddon.cpp @@ -7,6 +7,7 @@ #include "InterfaceUtils.h" #include "MessageDriverSettingsUtils.h" +#include "settings_tools.h" #include #include @@ -20,6 +21,7 @@ PPPUpAddon::PPPUpAddon(BMessage *addons, ConnectionView *connectionView) : DialUpAddon(addons), + fAskBeforeConnecting(false), fHasPassword(false), fAuthenticatorsCount(0), fSettings(NULL), @@ -51,7 +53,7 @@ bool PPPUpAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew) { fIsNew = isNew; - fHasPassword = false; + fAskBeforeConnecting = fHasPassword = false; fDeviceName = fUsername = fPassword = ""; fDeviceAddon = NULL; fAuthenticatorsCount = 0; @@ -63,6 +65,18 @@ PPPUpAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew) if(!settings || !profile || isNew) return true; + BMessage parameter; + int32 index = 0; + const char *value; + if(FindMessageParameter(PPP_ASK_BEFORE_CONNECTING_KEY, *fSettings, ¶meter, + &index) && parameter.FindString(MDSU_VALUES, &value) == B_OK) { + if(get_boolean_value(value, false)) + fAskBeforeConnecting = true; + + parameter.AddBool(MDSU_VALID, true); + fSettings->ReplaceMessage(MDSU_PARAMETERS, index, ¶meter); + } + if(!LoadDeviceSettings()) return false; diff --git a/src/apps/bin/ppp_up/PPPUpAddon.h b/src/apps/bin/ppp_up/PPPUpAddon.h index 1cd65436d3..22c12432a0 100644 --- a/src/apps/bin/ppp_up/PPPUpAddon.h +++ b/src/apps/bin/ppp_up/PPPUpAddon.h @@ -26,6 +26,8 @@ class PPPUpAddon : public DialUpAddon { bool IsNew() const { return fIsNew; } + bool AskBeforeConnecting() const + { return fAskBeforeConnecting; } const char *DeviceName() const { return fDeviceName.String(); } @@ -71,7 +73,7 @@ class PPPUpAddon : public DialUpAddon { bool MarkAuthenticatorAsValid(const BString& moduleName); private: - bool fIsNew, fHasPassword; + bool fIsNew, fAskBeforeConnecting, fHasPassword; BString fDeviceName, fAuthenticatorName, fUsername, fPassword; DialUpAddon *fDeviceAddon; int32 fAuthenticatorsCount; diff --git a/src/apps/bin/ppp_up/README b/src/apps/bin/ppp_up/README index 493525ab4d..c87a36eab6 100644 --- a/src/apps/bin/ppp_up/README +++ b/src/apps/bin/ppp_up/README @@ -2,6 +2,6 @@ Usage: ppp_up INTERFACENAME The app waits until it receives a thread message containing the interface id. The sender of this message will wait for a reply that indicates that ppp_up is ready to run. The replying thread will be registered as a report message receiver (no reply timeout). -If the interface is configured to ask the user before dialing or if the password is missing although a login is needed, ppp_up will open a request window and wait for the user to enter the login information. All changes will be saved. Actually, the login view that is presented to the user is the same as the one used in the dial-up settings (including its behaviour). +If the interface is configured to ask the user before connecting or if the password is missing although a login is needed, ppp_up will open a request window and wait for the user to enter the login information. All changes will be saved. Actually, the login view that is presented to the user is the same as the one used in the "Internet" settings (including its behaviour). If a connection could be established ppp_up will add a connection status replicant to the Deskbar. diff --git a/src/apps/bin/pppconfig/pppconfig.cpp b/src/apps/bin/pppconfig/pppconfig.cpp index 1e55e32f77..e2e124827d 100644 --- a/src/apps/bin/pppconfig/pppconfig.cpp +++ b/src/apps/bin/pppconfig/pppconfig.cpp @@ -263,11 +263,13 @@ show_details(const char *name) // ID printf("ID: %ld\n", interface.ID()); - // DialOnDemand - printf("DialOnDemand: %s\n", info.info.doesDialOnDemand ? "Enabled" : "Disabled"); + // ConnectOnDemand + printf("ConnectOnDemand: %s\n", info.info.doesConnectOnDemand ? + "Enabled" : "Disabled"); - // AutoRedial - printf("AutoRedial: %s\n", info.info.doesAutoRedial ? "Enabled" : "Disabled"); + // AutoReconnect + printf("AutoReconnect: %s\n", info.info.doesAutoReconnect ? + "Enabled" : "Disabled"); // MRU and interfaceMTU printf("MRU: %ld\n", info.info.MRU);