Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 48310 | Differences between
and this patch

Collapse All | Expand All

(-)kppp/cbtype.h (+8 lines)
Line 0 Link Here
1
#ifndef __CBTYPE__H__
2
#define __CBTYPE__H__
3
4
#define CBTYPE_NONE     0
5
#define CBTYPE_ADMIN    1
6
#define CBTYPE_USER     2
7
8
#endif
(-)kppp/connect.cpp (-2 / +42 lines)
Lines 62-67 Link Here
62
#endif
62
#endif
63
63
64
#include "auth.h"
64
#include "auth.h"
65
#include "cbtype.h"
65
#include "connect.h"
66
#include "connect.h"
66
#include "docking.h"
67
#include "docking.h"
67
#include "main.h"
68
#include "main.h"
Lines 353-359 Link Here
353
354
354
  if(vmain == 4) {
355
  if(vmain == 4) {
355
    if(!expecting) {
356
    if(!expecting) {
356
      if(!gpppdata.waitForDialTone()) {
357
      if(!gpppdata.waitForDialTone() || gpppdata.waitCallback()) {
357
	QString msg = i18n("Turning off dial tone waiting...");
358
	QString msg = i18n("Turning off dial tone waiting...");
358
	messg->setText(msg);
359
	messg->setText(msg);
359
	emit debugMessage(msg);
360
	emit debugMessage(msg);
Lines 372-377 Link Here
372
      timeout_timer->stop();
373
      timeout_timer->stop();
373
      timeout_timer->start(gpppdata.modemTimeout()*1000);
374
      timeout_timer->start(gpppdata.modemTimeout()*1000);
374
375
376
      if(gpppdata.waitCallback()) {
377
        QString msg = i18n("Waiting for callback...");
378
        messg->setText(msg);
379
        emit debugMessage(msg);
380
        setExpect(gpppdata.modemRingResp());
381
        vmain = 102;
382
        return;
383
      }
384
375
      QStringList &plist = gpppdata.phonenumbers();
385
      QStringList &plist = gpppdata.phonenumbers();
376
      QString bmarg= gpppdata.dialPrefix();
386
      QString bmarg= gpppdata.dialPrefix();
377
      bmarg += *plist.at(dialnumber);
387
      bmarg += *plist.at(dialnumber);
Lines 424-429 Link Here
424
      Modem::modem->setDataMode(false);
434
      Modem::modem->setDataMode(false);
425
      vmain = 0;
435
      vmain = 0;
426
      substate = -1;
436
      substate = -1;
437
      gpppdata.setWaitCallback(false);
427
      return;
438
      return;
428
    }
439
    }
429
440
Lines 433-438 Link Here
433
      messg->setText(i18n("No Dial Tone"));
444
      messg->setText(i18n("No Dial Tone"));
434
      vmain = 20;
445
      vmain = 20;
435
      Modem::modem->unlockdevice();
446
      Modem::modem->unlockdevice();
447
      gpppdata.setWaitCallback(false);
436
      return;
448
      return;
437
    }
449
    }
438
450
Lines 442-447 Link Here
442
      messg->setText(i18n("No Carrier"));
454
      messg->setText(i18n("No Carrier"));
443
      vmain = 20;
455
      vmain = 20;
444
      Modem::modem->unlockdevice();
456
      Modem::modem->unlockdevice();
457
      gpppdata.setWaitCallback(false);
445
      return;
458
      return;
446
    }
459
    }
447
460
Lines 458-463 Link Here
458
                              "Do NOT connect this modem to a digital phone "
471
                              "Do NOT connect this modem to a digital phone "
459
			      "line or the modem could get permanently "
472
			      "line or the modem could get permanently "
460
			      "damaged"));
473
			      "damaged"));
474
      gpppdata.setWaitCallback(false);
461
      return;
475
      return;
462
    }
476
    }
463
477
Lines 477-482 Link Here
477
      return;
491
      return;
478
    }
492
    }
479
  }
493
  }
494
  
495
  // send answer on callback phase
496
  if(vmain == 102) {
497
    if(!expecting) {
498
      writeline(gpppdata.modemAnswerStr());
499
      setExpect(gpppdata.modemConnectResp());
500
      vmain = 100;
501
      return;
502
    }
503
  }
480
504
481
  // execute the script
505
  // execute the script
482
  if(vmain == 2) {
506
  if(vmain == 2) {
Lines 877-882 Link Here
877
	// starting pppd wasn't successful. Error messages were
901
	// starting pppd wasn't successful. Error messages were
878
	// handled by execppp();
902
	// handled by execppp();
879
	if_timeout_timer->stop();
903
	if_timeout_timer->stop();
904
880
	this->hide();
905
	this->hide();
881
	messg->setText("");
906
	messg->setText("");
882
	p_kppp->quit_b->setFocus();
907
	p_kppp->quit_b->setFocus();
Lines 897-902 Link Here
897
  // this is a "wait until cancel" entry
922
  // this is a "wait until cancel" entry
898
923
899
  if(vmain == 20) {
924
  if(vmain == 20) {
925
    gpppdata.setWaitCallback(false);
900
  }
926
  }
901
}
927
}
902
928
Lines 985-990 Link Here
985
1011
986
1012
987
void ConnectWidget::cancelbutton() {
1013
void ConnectWidget::cancelbutton() {
1014
  gpppdata.setWaitCallback(false);
988
  Modem::modem->stop();
1015
  Modem::modem->stop();
989
  killTimer(main_timer_ID);
1016
  killTimer(main_timer_ID);
990
  timeout_timer->stop();
1017
  timeout_timer->stop();
Lines 1229-1234 Link Here
1229
  {
1256
  {
1230
    command += " " + *it;
1257
    command += " " + *it;
1231
  }
1258
  }
1259
  
1260
  // Callback settings
1261
  if(gpppdata.callbackType() && !gpppdata.waitCallback()) {
1262
    if(!gpppdata.pppdVersionMin(2,4,2)) {
1263
      command += " +callback";
1264
      if(gpppdata.callbackType() == CBTYPE_USER)
1265
        command += " callback " + gpppdata.callbackPhone();
1266
    } else {
1267
      command += " callback ";
1268
      command += (gpppdata.callbackType() == CBTYPE_ADMIN ? "0" : gpppdata.callbackPhone());
1269
    }
1270
  } else
1271
    gpppdata.setWaitCallback(false);
1232
1272
1233
  // PAP settings
1273
  // PAP settings
1234
  if(gpppdata.authMethod() == AUTH_PAP) {
1274
  if(gpppdata.authMethod() == AUTH_PAP) {
Lines 1262-1268 Link Here
1262
  }
1302
  }
1263
1303
1264
  kapp->flushX();
1304
  kapp->flushX();
1265
1305
  
1266
  return Requester::rq->execPPPDaemon(command);
1306
  return Requester::rq->execPPPDaemon(command);
1267
}
1307
}
1268
1308
(-)kppp/edit.cpp (-3 / +43 lines)
Lines 43-53 Link Here
43
#include "newwidget.h"
43
#include "newwidget.h"
44
#include "iplined.h"
44
#include "iplined.h"
45
#include "auth.h"
45
#include "auth.h"
46
#include "cbtype.h"
46
47
47
DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name )
48
DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name )
48
  : QWidget(parent, name)
49
  : QWidget(parent, name)
49
{
50
{
50
  const int GRIDROWS = 6;
51
  const int GRIDROWS = 8;
51
52
52
  QGridLayout *tl = new QGridLayout(parent, GRIDROWS, 2, 0, KDialog::spacingHint());
53
  QGridLayout *tl = new QGridLayout(parent, GRIDROWS, 2, 0, KDialog::spacingHint());
53
54
Lines 150-159 Link Here
150
		       "plain text in the config file, which is\n"
151
		       "plain text in the config file, which is\n"
151
		       "readable only to you. Make sure nobody\n"
152
		       "readable only to you. Make sure nobody\n"
152
		       "gains access to this file!"));
153
		       "gains access to this file!"));
153
154
		       
155
  cbtype_l = new QLabel(i18n("&Callback type:"), parent);
156
  tl->addWidget(cbtype_l, 5, 0);
157
158
  cbtype = new QComboBox(parent);
159
  cbtype_l->setBuddy(cbtype);
160
  cbtype->insertItem(i18n("None"));
161
  cbtype->insertItem(i18n("Administrator-defined"));
162
  cbtype->insertItem(i18n("User-defined"));
163
  connect(cbtype, SIGNAL(highlighted(int)),
164
	  this, SLOT(cbtypeChanged(int)));
165
  tl->addWidget(cbtype, 5, 1);
166
  tmp = i18n("Callback type");
167
168
  QWhatsThis::add(cbtype_l,tmp);
169
  QWhatsThis::add(cbtype,tmp);
170
171
  cbphone_l = new QLabel(i18n("Call&back number:"), parent);
172
  tl->addWidget(cbphone_l, 6, 0);
173
  
174
  cbphone = new QLineEdit(parent);  
175
  cbphone_l->setBuddy(cbphone);
176
  cbphone->setMaxLength(14);
177
  tl->addWidget(cbphone, 6, 1);
178
  tmp = i18n("Callback phone number");
179
180
  QWhatsThis::add(cbphone_l,tmp);
181
  QWhatsThis::add(cbphone,tmp);
182
  
154
  pppdargs = new QPushButton(i18n("Customize &pppd Arguments..."), parent);
183
  pppdargs = new QPushButton(i18n("Customize &pppd Arguments..."), parent);
155
  connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton()));
184
  connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton()));
156
  tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter);
185
  tl->addMultiCellWidget(pppdargs, 7, 7, 0, 1, AlignCenter);
157
186
158
  // Set defaults if editing an existing connection
187
  // Set defaults if editing an existing connection
159
  if(!isnewaccount) {
188
  if(!isnewaccount) {
Lines 177-187 Link Here
177
206
178
    auth->setCurrentItem(gpppdata.authMethod());
207
    auth->setCurrentItem(gpppdata.authMethod());
179
    store_password->setChecked(gpppdata.storePassword());
208
    store_password->setChecked(gpppdata.storePassword());
209
    cbtype->setCurrentItem(gpppdata.callbackType());
210
    cbphone->setText(gpppdata.callbackPhone());
180
  } else {
211
  } else {
181
    // select PAP/CHAP as default
212
    // select PAP/CHAP as default
182
    auth->setCurrentItem(AUTH_PAPCHAP);
213
    auth->setCurrentItem(AUTH_PAPCHAP);
214
    // select NONE as default
215
    cbtype->setCurrentItem(CBTYPE_NONE);
183
  }
216
  }
184
217
218
  emit cbtypeChanged(cbtype->currentItem());
185
  numbersChanged();
219
  numbersChanged();
186
  tl->activate();
220
  tl->activate();
187
}
221
}
Lines 205-210 Link Here
205
    gpppdata.setPhonenumber(number);
239
    gpppdata.setPhonenumber(number);
206
    gpppdata.setAuthMethod(auth->currentItem());
240
    gpppdata.setAuthMethod(auth->currentItem());
207
    gpppdata.setStorePassword(store_password->isChecked());
241
    gpppdata.setStorePassword(store_password->isChecked());
242
    gpppdata.setCallbackType(cbtype->currentItem());
243
    gpppdata.setCallbackPhone(cbphone->text());
208
    return true;
244
    return true;
209
  }
245
  }
210
}
246
}
Lines 218-223 Link Here
218
  down->setEnabled(sel != -1 && sel != (int)numbers->count()-1);
254
  down->setEnabled(sel != -1 && sel != (int)numbers->count()-1);
219
}
255
}
220
256
257
void DialWidget::cbtypeChanged(int value) {
258
  cbphone_l->setEnabled(value == CBTYPE_USER);
259
  cbphone->setEnabled(value == CBTYPE_USER);
260
}
221
261
222
void DialWidget::selectionChanged(int) {
262
void DialWidget::selectionChanged(int) {
223
  numbersChanged();
263
  numbersChanged();
(-)kppp/edit.h (+6 lines)
Lines 57-62 Link Here
57
  bool save();
57
  bool save();
58
  void pppdargsbutton();
58
  void pppdargsbutton();
59
  void numbersChanged();
59
  void numbersChanged();
60
  void cbtypeChanged(int);
60
  void selectionChanged(int);
61
  void selectionChanged(int);
61
  void addNumber();
62
  void addNumber();
62
  void delNumber();
63
  void delNumber();
Lines 72-77 Link Here
72
  QLabel *auth_l;
73
  QLabel *auth_l;
73
  QCheckBox *store_password;
74
  QCheckBox *store_password;
74
75
76
  // callback support
77
  QComboBox *cbtype;
78
  QLabel *cbtype_l;
79
  QLineEdit *cbphone;
80
  QLabel *cbphone_l;
75
  // for the phonenumber selection
81
  // for the phonenumber selection
76
  QPushButton *add, *del, *up, *down;
82
  QPushButton *add, *del, *up, *down;
77
  QListBox *numbers;
83
  QListBox *numbers;
(-)kppp/kpppwidget.cpp (-4 / +10 lines)
Lines 495-502 Link Here
495
      removedns();
495
      removedns();
496
      Modem::modem->unlockdevice();
496
      Modem::modem->unlockdevice();
497
      con->pppdDied();
497
      con->pppdDied();
498
498
      
499
      if(!gpppdata.automatic_redial()) {
499
      Requester::rq->pppdExitStatus();
500
      gpppdata.setWaitCallback(gpppdata.callbackType() && Requester::rq->lastStatus == E_CBCP_WAIT);
501
      
502
      if(!gpppdata.automatic_redial() && !gpppdata.waitCallback()) {
500
	quit_b->setFocus();
503
	quit_b->setFocus();
501
	show();
504
	show();
502
	con_win->stopClock();
505
	con_win->stopClock();
Lines 525-531 Link Here
525
	if(KMessageBox::warningYesNo(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == KMessageBox::No)
528
	if(KMessageBox::warningYesNo(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == KMessageBox::No)
526
	  PPPL_ShowLog();
529
	  PPPL_ShowLog();
527
      } else { /* reconnect on disconnect */
530
      } else { /* reconnect on disconnect */
528
	kdDebug(5002) << "Trying to reconnect... " << endl;
531
        if(gpppdata.waitCallback())
532
          kdDebug(5002) << "Waiting for callback... " << endl;
533
        else
534
          kdDebug(5002) << "Trying to reconnect... " << endl;
529
535
530
        if(gpppdata.authMethod() == AUTH_PAP ||
536
        if(gpppdata.authMethod() == AUTH_PAP ||
531
	   gpppdata.authMethod() == AUTH_CHAP ||
537
	   gpppdata.authMethod() == AUTH_CHAP ||
Lines 538-544 Link Here
538
	con_win->stopClock();
544
	con_win->stopClock();
539
	stopAccounting();
545
	stopAccounting();
540
	gpppdata.setpppdRunning(false);
546
	gpppdata.setpppdRunning(false);
541
	// not in a signal handler !!!	KNotifyClient::beep();
547
	// not in a signal handler !!!  KNotifyClient::beep();
542
	emit cmdl_start();
548
	emit cmdl_start();
543
    }
549
    }
544
  }
550
  }
(-)kppp/Makefile.in (+1 lines)
Lines 409-414 Link Here
409
		runtests.h \
409
		runtests.h \
410
		loginterm.h \
410
		loginterm.h \
411
		auth.h \
411
		auth.h \
412
		cbtype.h \
412
		version.h \
413
		version.h \
413
		macros.h \
414
		macros.h \
414
		ppplog.h \
415
		ppplog.h \
(-)kppp/pppdata.cpp (-1 / +25 lines)
Lines 43-49 Link Here
43
     caccount(-1),         // set the current account index also
43
     caccount(-1),         // set the current account index also
44
     suidprocessid(-1),    // process ID of setuid child
44
     suidprocessid(-1),    // process ID of setuid child
45
     pppdisrunning(false),
45
     pppdisrunning(false),
46
     pppderror(0)
46
     pppderror(0),
47
     waitcallback(false)
47
{
48
{
48
}
49
}
49
50
Lines 897-902 Link Here
897
  return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1);
898
  return (bool)readNumConfig(cgroup, STORE_PASSWORD_KEY, 1);
898
}
899
}
899
900
901
int PPPData::callbackType() {
902
  return readNumConfig(cgroup, CALLBACK_TYPE_KEY, 0);
903
}
904
905
void PPPData::setCallbackType(int value) {
906
  writeConfig(cgroup, CALLBACK_TYPE_KEY, value);
907
}
908
909
const QString PPPData::callbackPhone() {
910
  return readConfig(cgroup, CALLBACK_PHONE_KEY, "");
911
}
912
913
void PPPData::setCallbackPhone(const QString &b) {
914
  writeConfig(cgroup, CALLBACK_PHONE_KEY, b);
915
}
916
917
bool PPPData::waitCallback() {
918
  return waitcallback;
919
}
920
921
void PPPData::setWaitCallback(bool value) {
922
  waitcallback = value;
923
}
900
924
901
const QString PPPData::command_before_connect() {
925
const QString PPPData::command_before_connect() {
902
  return readConfig(cgroup, BEFORE_CONNECT_KEY);
926
  return readConfig(cgroup, BEFORE_CONNECT_KEY);
(-)kppp/pppdata.h (+13 lines)
Lines 116-121 Link Here
116
#define STORED_PASSWORD_KEY "Password"
116
#define STORED_PASSWORD_KEY "Password"
117
#define STORED_USERNAME_KEY "Username"
117
#define STORED_USERNAME_KEY "Username"
118
#define STORE_PASSWORD_KEY "StorePassword"
118
#define STORE_PASSWORD_KEY "StorePassword"
119
#define CALLBACK_TYPE_KEY  "CallbackType"
120
#define CALLBACK_PHONE_KEY "CallbackPhone"
119
#define BEFORE_CONNECT_KEY  "BeforeConnect"
121
#define BEFORE_CONNECT_KEY  "BeforeConnect"
120
#define COMMAND_KEY        "Command"
122
#define COMMAND_KEY        "Command"
121
#define DISCONNECT_COMMAND_KEY "DisconnectCommand"
123
#define DISCONNECT_COMMAND_KEY "DisconnectCommand"
Lines 151-156 Link Here
151
// pppd errors
153
// pppd errors
152
#define E_IF_TIMEOUT       1
154
#define E_IF_TIMEOUT       1
153
#define E_PPPD_DIED        2
155
#define E_PPPD_DIED        2
156
#define E_CBCP_WAIT       14
154
157
155
// window position
158
// window position
156
#define WINPOS_CONWIN_X    "WindowPositionConWinX"
159
#define WINPOS_CONWIN_X    "WindowPositionConWinX"
Lines 355-360 Link Here
355
  bool storePassword();
358
  bool storePassword();
356
  void setStorePassword(bool);
359
  void setStorePassword(bool);
357
360
361
  int callbackType();
362
  void setCallbackType(int);
363
  
364
  const QString callbackPhone();
365
  void setCallbackPhone(const QString &);
366
  
367
  bool waitCallback();
368
  void setWaitCallback(bool);
369
  
358
  const QString speed();
370
  const QString speed();
359
  void setSpeed(const QString &);
371
  void setSpeed(const QString &);
360
372
Lines 460-465 Link Here
460
                                         // daemon
472
                                         // daemon
461
  int pppderror;                         // error encounterd running pppd
473
  int pppderror;                         // error encounterd running pppd
462
  int pppdVer, pppdMod, pppdPatch;       // pppd version
474
  int pppdVer, pppdMod, pppdPatch;       // pppd version
475
  bool waitcallback;			 // callback waiting flag
463
476
464
  QStringList phonelist;
477
  QStringList phonelist;
465
};
478
};

Return to bug 48310