Renamed "Dial" to "Connect".

ppp_up now checks for "AskBeforeConnecting" flag


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10498 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Waldemar Kornewald 2004-12-20 10:41:35 +00:00
parent 7577e5e2c4
commit 1d34350c71
5 changed files with 31 additions and 13 deletions

View File

@ -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;
}

View File

@ -7,6 +7,7 @@
#include "InterfaceUtils.h"
#include "MessageDriverSettingsUtils.h"
#include "settings_tools.h"
#include <Box.h>
#include <Button.h>
@ -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, &parameter,
&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, &parameter);
}
if(!LoadDeviceSettings())
return false;

View File

@ -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;

View File

@ -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.

View File

@ -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);