Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 29608 Details for
Bug 48310
KPPP patch to dial with callback
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
kppp-callback.patch
kppp-callback.patch (text/plain), 11.72 KB, created by
Valery Kartel
on 2004-04-19 04:49:11 UTC
(
hide
)
Description:
kppp-callback.patch
Filename:
MIME Type:
Creator:
Valery Kartel
Created:
2004-04-19 04:49:11 UTC
Size:
11.72 KB
patch
obsolete
>diff -urN kdenetwork-3.2.1.orig/kppp/cbtype.h kdenetwork-3.2.1/kppp/cbtype.h >--- kdenetwork-3.2.1.orig/kppp/cbtype.h 1970-01-01 03:00:00.000000000 +0300 >+++ kdenetwork-3.2.1/kppp/cbtype.h 2004-04-16 02:01:04.745373912 +0300 >@@ -0,0 +1,8 @@ >+#ifndef __CBTYPE__H__ >+#define __CBTYPE__H__ >+ >+#define CBTYPE_NONE 0 >+#define CBTYPE_ADMIN 1 >+#define CBTYPE_USER 2 >+ >+#endif >diff -urN kdenetwork-3.2.1.orig/kppp/connect.cpp kdenetwork-3.2.1/kppp/connect.cpp >--- kdenetwork-3.2.1.orig/kppp/connect.cpp 2003-09-02 16:58:35.000000000 +0300 >+++ kdenetwork-3.2.1/kppp/connect.cpp 2004-04-16 02:01:04.747373608 +0300 >@@ -62,6 +62,7 @@ > #endif > > #include "auth.h" >+#include "cbtype.h" > #include "connect.h" > #include "docking.h" > #include "main.h" >@@ -353,7 +354,7 @@ > > if(vmain == 4) { > if(!expecting) { >- if(!gpppdata.waitForDialTone()) { >+ if(!gpppdata.waitForDialTone() || gpppdata.waitCallback()) { > QString msg = i18n("Turning off dial tone waiting..."); > messg->setText(msg); > emit debugMessage(msg); >@@ -372,6 +373,15 @@ > timeout_timer->stop(); > timeout_timer->start(gpppdata.modemTimeout()*1000); > >+ if(gpppdata.waitCallback()) { >+ QString msg = i18n("Waiting for callback..."); >+ messg->setText(msg); >+ emit debugMessage(msg); >+ setExpect(gpppdata.modemRingResp()); >+ vmain = 102; >+ return; >+ } >+ > QStringList &plist = gpppdata.phonenumbers(); > QString bmarg= gpppdata.dialPrefix(); > bmarg += *plist.at(dialnumber); >@@ -424,6 +434,7 @@ > Modem::modem->setDataMode(false); > vmain = 0; > substate = -1; >+ gpppdata.setWaitCallback(false); > return; > } > >@@ -433,6 +444,7 @@ > messg->setText(i18n("No Dial Tone")); > vmain = 20; > Modem::modem->unlockdevice(); >+ gpppdata.setWaitCallback(false); > return; > } > >@@ -442,6 +454,7 @@ > messg->setText(i18n("No Carrier")); > vmain = 20; > Modem::modem->unlockdevice(); >+ gpppdata.setWaitCallback(false); > return; > } > >@@ -458,6 +471,7 @@ > "Do NOT connect this modem to a digital phone " > "line or the modem could get permanently " > "damaged")); >+ gpppdata.setWaitCallback(false); > return; > } > >@@ -477,6 +491,16 @@ > return; > } > } >+ >+ // send answer on callback phase >+ if(vmain == 102) { >+ if(!expecting) { >+ writeline(gpppdata.modemAnswerStr()); >+ setExpect(gpppdata.modemConnectResp()); >+ vmain = 100; >+ return; >+ } >+ } > > // execute the script > if(vmain == 2) { >@@ -877,6 +901,7 @@ > // starting pppd wasn't successful. Error messages were > // handled by execppp(); > if_timeout_timer->stop(); >+ > this->hide(); > messg->setText(""); > p_kppp->quit_b->setFocus(); >@@ -897,6 +922,7 @@ > // this is a "wait until cancel" entry > > if(vmain == 20) { >+ gpppdata.setWaitCallback(false); > } > } > >@@ -985,6 +1011,7 @@ > > > void ConnectWidget::cancelbutton() { >+ gpppdata.setWaitCallback(false); > Modem::modem->stop(); > killTimer(main_timer_ID); > timeout_timer->stop(); >@@ -1229,6 +1256,19 @@ > { > command += " " + *it; > } >+ >+ // Callback settings >+ if(gpppdata.callbackType() && !gpppdata.waitCallback()) { >+ if(!gpppdata.pppdVersionMin(2,4,2)) { >+ command += " +callback"; >+ if(gpppdata.callbackType() == CBTYPE_USER) >+ command += " callback " + gpppdata.callbackPhone(); >+ } else { >+ command += " callback "; >+ command += (gpppdata.callbackType() == CBTYPE_ADMIN ? "0" : gpppdata.callbackPhone()); >+ } >+ } else >+ gpppdata.setWaitCallback(false); > > // PAP settings > if(gpppdata.authMethod() == AUTH_PAP) { >@@ -1262,7 +1302,7 @@ > } > > kapp->flushX(); >- >+ > return Requester::rq->execPPPDaemon(command); > } > >diff -urN kdenetwork-3.2.1.orig/kppp/edit.cpp kdenetwork-3.2.1/kppp/edit.cpp >--- kdenetwork-3.2.1.orig/kppp/edit.cpp 2003-05-15 18:33:54.000000000 +0300 >+++ kdenetwork-3.2.1/kppp/edit.cpp 2004-04-16 02:01:04.748373456 +0300 >@@ -43,11 +43,12 @@ > #include "newwidget.h" > #include "iplined.h" > #include "auth.h" >+#include "cbtype.h" > > DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) > : QWidget(parent, name) > { >- const int GRIDROWS = 6; >+ const int GRIDROWS = 8; > > QGridLayout *tl = new QGridLayout(parent, GRIDROWS, 2, 0, KDialog::spacingHint()); > >@@ -150,10 +151,38 @@ > "plain text in the config file, which is\n" > "readable only to you. Make sure nobody\n" > "gains access to this file!")); >- >+ >+ cbtype_l = new QLabel(i18n("&Callback type:"), parent); >+ tl->addWidget(cbtype_l, 5, 0); >+ >+ cbtype = new QComboBox(parent); >+ cbtype_l->setBuddy(cbtype); >+ cbtype->insertItem(i18n("None")); >+ cbtype->insertItem(i18n("Administrator-defined")); >+ cbtype->insertItem(i18n("User-defined")); >+ connect(cbtype, SIGNAL(highlighted(int)), >+ this, SLOT(cbtypeChanged(int))); >+ tl->addWidget(cbtype, 5, 1); >+ tmp = i18n("Callback type"); >+ >+ QWhatsThis::add(cbtype_l,tmp); >+ QWhatsThis::add(cbtype,tmp); >+ >+ cbphone_l = new QLabel(i18n("Call&back number:"), parent); >+ tl->addWidget(cbphone_l, 6, 0); >+ >+ cbphone = new QLineEdit(parent); >+ cbphone_l->setBuddy(cbphone); >+ cbphone->setMaxLength(14); >+ tl->addWidget(cbphone, 6, 1); >+ tmp = i18n("Callback phone number"); >+ >+ QWhatsThis::add(cbphone_l,tmp); >+ QWhatsThis::add(cbphone,tmp); >+ > pppdargs = new QPushButton(i18n("Customize &pppd Arguments..."), parent); > connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); >- tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); >+ tl->addMultiCellWidget(pppdargs, 7, 7, 0, 1, AlignCenter); > > // Set defaults if editing an existing connection > if(!isnewaccount) { >@@ -177,11 +206,16 @@ > > auth->setCurrentItem(gpppdata.authMethod()); > store_password->setChecked(gpppdata.storePassword()); >+ cbtype->setCurrentItem(gpppdata.callbackType()); >+ cbphone->setText(gpppdata.callbackPhone()); > } else { > // select PAP/CHAP as default > auth->setCurrentItem(AUTH_PAPCHAP); >+ // select NONE as default >+ cbtype->setCurrentItem(CBTYPE_NONE); > } > >+ emit cbtypeChanged(cbtype->currentItem()); > numbersChanged(); > tl->activate(); > } >@@ -205,6 +239,8 @@ > gpppdata.setPhonenumber(number); > gpppdata.setAuthMethod(auth->currentItem()); > gpppdata.setStorePassword(store_password->isChecked()); >+ gpppdata.setCallbackType(cbtype->currentItem()); >+ gpppdata.setCallbackPhone(cbphone->text()); > return true; > } > } >@@ -218,6 +254,10 @@ > down->setEnabled(sel != -1 && sel != (int)numbers->count()-1); > } > >+void DialWidget::cbtypeChanged(int value) { >+ cbphone_l->setEnabled(value == CBTYPE_USER); >+ cbphone->setEnabled(value == CBTYPE_USER); >+} > > void DialWidget::selectionChanged(int) { > numbersChanged(); >diff -urN kdenetwork-3.2.1.orig/kppp/edit.h kdenetwork-3.2.1/kppp/edit.h >--- kdenetwork-3.2.1.orig/kppp/edit.h 2003-05-15 18:33:54.000000000 +0300 >+++ kdenetwork-3.2.1/kppp/edit.h 2004-04-16 02:01:04.749373304 +0300 >@@ -57,6 +57,7 @@ > bool save(); > void pppdargsbutton(); > void numbersChanged(); >+ void cbtypeChanged(int); > void selectionChanged(int); > void addNumber(); > void delNumber(); >@@ -72,6 +73,11 @@ > QLabel *auth_l; > QCheckBox *store_password; > >+ // callback support >+ QComboBox *cbtype; >+ QLabel *cbtype_l; >+ QLineEdit *cbphone; >+ QLabel *cbphone_l; > // for the phonenumber selection > QPushButton *add, *del, *up, *down; > QListBox *numbers; >diff -urN kdenetwork-3.2.1.orig/kppp/kpppwidget.cpp kdenetwork-3.2.1/kppp/kpppwidget.cpp >--- kdenetwork-3.2.1.orig/kppp/kpppwidget.cpp 2003-11-30 11:48:38.000000000 +0200 >+++ kdenetwork-3.2.1/kppp/kpppwidget.cpp 2004-04-16 02:01:04.751373000 +0300 >@@ -495,8 +495,11 @@ > removedns(); > Modem::modem->unlockdevice(); > con->pppdDied(); >- >- if(!gpppdata.automatic_redial()) { >+ >+ Requester::rq->pppdExitStatus(); >+ gpppdata.setWaitCallback(gpppdata.callbackType() && Requester::rq->lastStatus == E_CBCP_WAIT); >+ >+ if(!gpppdata.automatic_redial() && !gpppdata.waitCallback()) { > quit_b->setFocus(); > show(); > con_win->stopClock(); >@@ -525,7 +528,10 @@ > if(KMessageBox::warningYesNo(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == KMessageBox::No) > PPPL_ShowLog(); > } else { /* reconnect on disconnect */ >- kdDebug(5002) << "Trying to reconnect... " << endl; >+ if(gpppdata.waitCallback()) >+ kdDebug(5002) << "Waiting for callback... " << endl; >+ else >+ kdDebug(5002) << "Trying to reconnect... " << endl; > > if(gpppdata.authMethod() == AUTH_PAP || > gpppdata.authMethod() == AUTH_CHAP || >@@ -538,7 +544,7 @@ > con_win->stopClock(); > stopAccounting(); > gpppdata.setpppdRunning(false); >- // not in a signal handler !!! KNotifyClient::beep(); >+ // not in a signal handler !!! KNotifyClient::beep(); > emit cmdl_start(); > } > } >diff -urN kdenetwork-3.2.1.orig/kppp/Makefile.in kdenetwork-3.2.1/kppp/Makefile.in >--- kdenetwork-3.2.1.orig/kppp/Makefile.in 2004-03-01 18:03:15.000000000 +0200 >+++ kdenetwork-3.2.1/kppp/Makefile.in 2004-04-16 02:01:35.864643064 +0300 >@@ -409,6 +409,7 @@ > runtests.h \ > loginterm.h \ > auth.h \ >+ cbtype.h \ > version.h \ > macros.h \ > ppplog.h \ >diff -urN kdenetwork-3.2.1.orig/kppp/pppdata.cpp kdenetwork-3.2.1/kppp/pppdata.cpp >--- kdenetwork-3.2.1.orig/kppp/pppdata.cpp 2004-01-17 14:54:17.000000000 +0200 >+++ kdenetwork-3.2.1/kppp/pppdata.cpp 2004-04-16 02:01:35.865642912 +0300 >@@ -43,7 +43,8 @@ > caccount(-1), // set the current account index also > suidprocessid(-1), // process ID of setuid child > pppdisrunning(false), >- pppderror(0) >+ pppderror(0), >+ waitcallback(false) > { > } > >@@ -897,6 +898,29 @@ > return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1); > } > >+int PPPData::callbackType() { >+ return readNumConfig(cgroup, CALLBACK_TYPE_KEY, 0); >+} >+ >+void PPPData::setCallbackType(int value) { >+ writeConfig(cgroup, CALLBACK_TYPE_KEY, value); >+} >+ >+const QString PPPData::callbackPhone() { >+ return readConfig(cgroup, CALLBACK_PHONE_KEY, ""); >+} >+ >+void PPPData::setCallbackPhone(const QString &b) { >+ writeConfig(cgroup, CALLBACK_PHONE_KEY, b); >+} >+ >+bool PPPData::waitCallback() { >+ return waitcallback; >+} >+ >+void PPPData::setWaitCallback(bool value) { >+ waitcallback = value; >+} > > const QString PPPData::command_before_connect() { > return readConfig(cgroup, BEFORE_CONNECT_KEY); >diff -urN kdenetwork-3.2.1.orig/kppp/pppdata.h kdenetwork-3.2.1/kppp/pppdata.h >--- kdenetwork-3.2.1.orig/kppp/pppdata.h 2003-07-21 10:38:12.000000000 +0300 >+++ kdenetwork-3.2.1/kppp/pppdata.h 2004-04-16 02:01:35.866642760 +0300 >@@ -116,6 +116,8 @@ > #define STORED_PASSWORD_KEY "Password" > #define STORED_USERNAME_KEY "Username" > #define STORE_PASSWORD_KEY "StorePassword" >+#define CALLBACK_TYPE_KEY "CallbackType" >+#define CALLBACK_PHONE_KEY "CallbackPhone" > #define BEFORE_CONNECT_KEY "BeforeConnect" > #define COMMAND_KEY "Command" > #define DISCONNECT_COMMAND_KEY "DisconnectCommand" >@@ -151,6 +153,7 @@ > // pppd errors > #define E_IF_TIMEOUT 1 > #define E_PPPD_DIED 2 >+#define E_CBCP_WAIT 14 > > // window position > #define WINPOS_CONWIN_X "WindowPositionConWinX" >@@ -355,6 +358,15 @@ > bool storePassword(); > void setStorePassword(bool); > >+ int callbackType(); >+ void setCallbackType(int); >+ >+ const QString callbackPhone(); >+ void setCallbackPhone(const QString &); >+ >+ bool waitCallback(); >+ void setWaitCallback(bool); >+ > const QString speed(); > void setSpeed(const QString &); > >@@ -460,6 +472,7 @@ > // daemon > int pppderror; // error encounterd running pppd > int pppdVer, pppdMod, pppdPatch; // pppd version >+ bool waitcallback; // callback waiting flag > > QStringList phonelist; > };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 48310
:
29608
|
35374