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
+6 -6
View File
@@ -159,8 +159,8 @@ ConnectionView::AttachedToWindow()
fCancelButton->SetTarget(this); fCancelButton->SetTarget(this);
fSettings.LoadSettings(fInterfaceName.String(), false); fSettings.LoadSettings(fInterfaceName.String(), false);
if(fAddon->CountAuthenticators() == 0 || fAddon->HasPassword()) if(fAddon->CountAuthenticators() == 0 || fAddon->HasPassword()
// TODO: || AskBeforeDialing == true || fAddon->AskBeforeConnecting())
Connect(); Connect();
} }
@@ -256,8 +256,8 @@ ConnectionView::Cancel()
interface->GetInterfaceInfo(&info); interface->GetInterfaceInfo(&info);
if(info.info.phase < PPP_ESTABLISHED_PHASE) { if(info.info.phase < PPP_ESTABLISHED_PHASE) {
thread_id down = spawn_thread(down_thread, "up_thread", B_NORMAL_PRIORITY, thread_id down = spawn_thread(down_thread, "down_thread",
interface); B_NORMAL_PRIORITY, interface);
resume_thread(down); resume_thread(down);
} else } else
delete interface; delete interface;
@@ -282,8 +282,8 @@ ConnectionView::AttemptString() const
ppp_interface_info_t info; ppp_interface_info_t info;
interface.GetInterfaceInfo(&info); interface.GetInterfaceInfo(&info);
BString attempt; BString attempt;
attempt << "Attempt " << info.info.dialRetry << " of " << attempt << "Attempt " << info.info.connectRetry << " of " <<
info.info.dialRetriesLimit; info.info.connectRetriesLimit;
return attempt; return attempt;
} }
+15 -1
View File
@@ -7,6 +7,7 @@
#include "InterfaceUtils.h" #include "InterfaceUtils.h"
#include "MessageDriverSettingsUtils.h" #include "MessageDriverSettingsUtils.h"
#include "settings_tools.h"
#include <Box.h> #include <Box.h>
#include <Button.h> #include <Button.h>
@@ -20,6 +21,7 @@
PPPUpAddon::PPPUpAddon(BMessage *addons, ConnectionView *connectionView) PPPUpAddon::PPPUpAddon(BMessage *addons, ConnectionView *connectionView)
: DialUpAddon(addons), : DialUpAddon(addons),
fAskBeforeConnecting(false),
fHasPassword(false), fHasPassword(false),
fAuthenticatorsCount(0), fAuthenticatorsCount(0),
fSettings(NULL), fSettings(NULL),
@@ -51,7 +53,7 @@ bool
PPPUpAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew) PPPUpAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew)
{ {
fIsNew = isNew; fIsNew = isNew;
fHasPassword = false; fAskBeforeConnecting = fHasPassword = false;
fDeviceName = fUsername = fPassword = ""; fDeviceName = fUsername = fPassword = "";
fDeviceAddon = NULL; fDeviceAddon = NULL;
fAuthenticatorsCount = 0; fAuthenticatorsCount = 0;
@@ -63,6 +65,18 @@ PPPUpAddon::LoadSettings(BMessage *settings, BMessage *profile, bool isNew)
if(!settings || !profile || isNew) if(!settings || !profile || isNew)
return true; 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()) if(!LoadDeviceSettings())
return false; return false;
+3 -1
View File
@@ -26,6 +26,8 @@ class PPPUpAddon : public DialUpAddon {
bool IsNew() const bool IsNew() const
{ return fIsNew; } { return fIsNew; }
bool AskBeforeConnecting() const
{ return fAskBeforeConnecting; }
const char *DeviceName() const const char *DeviceName() const
{ return fDeviceName.String(); } { return fDeviceName.String(); }
@@ -71,7 +73,7 @@ class PPPUpAddon : public DialUpAddon {
bool MarkAuthenticatorAsValid(const BString& moduleName); bool MarkAuthenticatorAsValid(const BString& moduleName);
private: private:
bool fIsNew, fHasPassword; bool fIsNew, fAskBeforeConnecting, fHasPassword;
BString fDeviceName, fAuthenticatorName, fUsername, fPassword; BString fDeviceName, fAuthenticatorName, fUsername, fPassword;
DialUpAddon *fDeviceAddon; DialUpAddon *fDeviceAddon;
int32 fAuthenticatorsCount; int32 fAuthenticatorsCount;
+1 -1
View File
@@ -2,6 +2,6 @@ Usage:
ppp_up INTERFACENAME 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). 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. If a connection could be established ppp_up will add a connection status replicant to the Deskbar.
+6 -4
View File
@@ -263,11 +263,13 @@ show_details(const char *name)
// ID // ID
printf("ID: %ld\n", interface.ID()); printf("ID: %ld\n", interface.ID());
// DialOnDemand // ConnectOnDemand
printf("DialOnDemand: %s\n", info.info.doesDialOnDemand ? "Enabled" : "Disabled"); printf("ConnectOnDemand: %s\n", info.info.doesConnectOnDemand ?
"Enabled" : "Disabled");
// AutoRedial // AutoReconnect
printf("AutoRedial: %s\n", info.info.doesAutoRedial ? "Enabled" : "Disabled"); printf("AutoReconnect: %s\n", info.info.doesAutoReconnect ?
"Enabled" : "Disabled");
// MRU and interfaceMTU // MRU and interfaceMTU
printf("MRU: %ld\n", info.info.MRU); printf("MRU: %ld\n", info.info.MRU);