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

Collapse All | Expand All

(-)a/lib/engine/components/evolution/evolution-book.cpp (-40 / +31 lines)
Lines 224-231 Evolution::Book::on_book_opened (EBookStatus _status) Link Here
224
    if (search_filter.empty ())
224
    if (search_filter.empty ())
225
      query = e_book_query_field_exists (E_CONTACT_FULL_NAME);
225
      query = e_book_query_field_exists (E_CONTACT_FULL_NAME);
226
    else
226
    else
227
      query = e_book_query_field_test (E_CONTACT_FULL_NAME, 
227
      query = e_book_query_field_test (E_CONTACT_FULL_NAME,
228
                                       E_BOOK_QUERY_CONTAINS, 
228
                                       E_BOOK_QUERY_CONTAINS,
229
                                       search_filter.c_str ());
229
                                       search_filter.c_str ());
230
230
231
    (void)e_book_async_get_book_view (book, query, NULL, 100,
231
    (void)e_book_async_get_book_view (book, query, NULL, 100,
Lines 233-239 Evolution::Book::on_book_opened (EBookStatus _status) Link Here
233
233
234
    e_book_query_unref (query);
234
    e_book_query_unref (query);
235
235
236
  } 
236
  }
237
  else {
237
  else {
238
238
239
    book = NULL;
239
    book = NULL;
Lines 304-312 Evolution::Book::refresh () Link Here
304
  remove_all_objects ();
304
  remove_all_objects ();
305
305
306
  /* we go */
306
  /* we go */
307
  if (e_book_is_opened (book)) 
307
  if (e_book_is_opened (book))
308
    on_book_opened_c (book, E_BOOK_ERROR_OK, this);
308
    on_book_opened_c (book, E_BOOK_ERROR_OK, this);
309
  else 
309
  else
310
    e_book_async_open (book, TRUE,
310
    e_book_async_open (book, TRUE,
311
                       on_book_opened_c, this);
311
                       on_book_opened_c, this);
312
}
312
}
Lines 360-398 Evolution::Book::on_new_contact_form_submitted (bool submitted, Link Here
360
  if ( !submitted)
360
  if ( !submitted)
361
    return;
361
    return;
362
362
363
  try {
363
  EContact *econtact = NULL;
364
    EContact *econtact = NULL;
364
365
365
366
366
  /* first check we have everything before using */
367
    /* first check we have everything before using */
367
  std::string name = result.text ("name");
368
    std::string name = result.text ("name");
368
  std::string home = result.text ("home");
369
    std::string home = result.text ("home");
369
  std::string cell = result.text ("cell");
370
    std::string cell = result.text ("cell");
370
  std::string work = result.text ("work");
371
    std::string work = result.text ("work");
371
  std::string pager = result.text ("pager");
372
    std::string pager = result.text ("pager");
372
  std::string video = result.text ("video");
373
    std::string video = result.text ("video");
373
374
374
  econtact = e_contact_new ();
375
    econtact = e_contact_new ();
375
  e_contact_set (econtact, E_CONTACT_FULL_NAME, (gpointer)name.c_str ());
376
    e_contact_set (econtact, E_CONTACT_FULL_NAME, (gpointer)name.c_str ());
376
  if ( !home.empty ())
377
    if ( !home.empty ())
377
    set_econtact_attribute_value (econtact, "HOME", home);
378
      set_econtact_attribute_value (econtact, "HOME", home);
378
  if ( !cell.empty ())
379
    if ( !cell.empty ())
379
    set_econtact_attribute_value (econtact, "CELL", cell);
380
      set_econtact_attribute_value (econtact, "CELL", cell);
380
  if ( !work.empty ())
381
    if ( !work.empty ())
381
    set_econtact_attribute_value (econtact, "WORK", work);
382
      set_econtact_attribute_value (econtact, "WORK", work);
382
  if ( !pager.empty ())
383
    if ( !pager.empty ())
383
    set_econtact_attribute_value (econtact, "PAGER", pager);
384
      set_econtact_attribute_value (econtact, "PAGER", pager);
384
  if ( !video.empty ())
385
    if ( !video.empty ())
385
    set_econtact_attribute_value (econtact, "VIDEO", video);
386
      set_econtact_attribute_value (econtact, "VIDEO", video);
386
387
387
  e_book_add_contact (book, econtact, NULL);
388
    e_book_add_contact (book, econtact, NULL);
388
  g_object_unref (econtact);
389
    g_object_unref (econtact);
390
391
  } catch (Ekiga::Form::not_found) {
392
#ifdef __GNUC__
393
    std::cerr << "Invalid result form submitted to "
394
	      << __PRETTY_FUNCTION__
395
	      << std::endl;
396
#endif
397
  }
398
}
389
}
(-)a/lib/engine/components/evolution/evolution-contact.cpp (-23 / +16 lines)
Lines 360-388 Evolution::Contact::on_edit_form_submitted (bool submitted, Link Here
360
  if (!submitted)
360
  if (!submitted)
361
    return;
361
    return;
362
362
363
  try {
363
  std::string name = result.text ("name");
364
364
  std::string home = result.text ("home");
365
    std::string name = result.text ("name");
365
  std::string cell = result.text ("cell");
366
    std::string home = result.text ("home");
366
  std::string work = result.text ("work");
367
    std::string cell = result.text ("cell");
367
  std::string pager = result.text ("pager");
368
    std::string work = result.text ("work");
368
  std::string video = result.text ("video");
369
    std::string pager = result.text ("pager");
369
370
    std::string video = result.text ("video");
370
  set_attribute_value (ATTR_HOME, home);
371
371
  set_attribute_value (ATTR_CELL, cell);
372
    set_attribute_value (ATTR_HOME, home);
372
  set_attribute_value (ATTR_WORK, work);
373
    set_attribute_value (ATTR_CELL, cell);
373
  set_attribute_value (ATTR_PAGER, pager);
374
    set_attribute_value (ATTR_WORK, work);
374
  set_attribute_value (ATTR_VIDEO, video);
375
    set_attribute_value (ATTR_PAGER, pager);
375
376
    set_attribute_value (ATTR_VIDEO, video);
376
  e_contact_set (econtact, E_CONTACT_FULL_NAME, (gpointer)name.c_str ());
377
377
378
    e_contact_set (econtact, E_CONTACT_FULL_NAME, (gpointer)name.c_str ());
378
  e_book_commit_contact (book, econtact, NULL);
379
380
    e_book_commit_contact (book, econtact, NULL);
381
382
  } catch (Ekiga::Form::not_found) {
383
384
    std::cerr << "Invalid result form" << std::endl; // FIXME: do better
385
  }
386
}
379
}
387
380
388
void
381
void
(-)a/lib/engine/components/ldap/ldap-book.cpp (-217 / +211 lines)
Lines 98-110 OPENLDAP::Book::parse_result (LDAPMessage* message) Link Here
98
        if (!strcasecmp(bv.bv_val,attributes[i]) && bvals && bvals[0].bv_val ) {
98
        if (!strcasecmp(bv.bv_val,attributes[i]) && bvals && bvals[0].bv_val ) {
99
	  call_addresses[attributes[i]] =
99
	  call_addresses[attributes[i]] =
100
	    /* FIXME: next line is annoying */
100
	    /* FIXME: next line is annoying */
101
	  	std::string ("sip:") +
101
	    std::string ("sip:") +
102
		  std::string (bvals[0].bv_val, bvals[0].bv_len);
102
	    std::string (bvals[0].bv_val, bvals[0].bv_len);
103
        }
103
        }
104
      }
104
      }
105
    }
105
    }
106
    if (bvals) ber_memfree(bvals);
106
    if (bvals) ber_memfree(bvals);
107
    }
107
  }
108
108
109
  ber_free (ber, 0);
109
  ber_free (ber, 0);
110
110
Lines 306-333 OPENLDAP::Book::Book (Ekiga::ServiceCore &_core, Link Here
306
    }
306
    }
307
    if (hostname_node) {
307
    if (hostname_node) {
308
308
309
	xmlUnlinkNode (hostname_node);
309
      xmlUnlinkNode (hostname_node);
310
        xmlFreeNode (hostname_node);
310
      xmlFreeNode (hostname_node);
311
    }
311
    }
312
    if (port_node) {
312
    if (port_node) {
313
313
314
	xmlUnlinkNode (port_node);
314
      xmlUnlinkNode (port_node);
315
        xmlFreeNode (port_node);
315
      xmlFreeNode (port_node);
316
    }
316
    }
317
    if (base_node) {
317
    if (base_node) {
318
318
319
	xmlUnlinkNode (base_node);
319
      xmlUnlinkNode (base_node);
320
        xmlFreeNode (base_node);
320
      xmlFreeNode (base_node);
321
    }
321
    }
322
    if (scope_node) {
322
    if (scope_node) {
323
323
324
	xmlUnlinkNode (scope_node);
324
      xmlUnlinkNode (scope_node);
325
        xmlFreeNode (scope_node);
325
      xmlFreeNode (scope_node);
326
    }
326
    }
327
    if (call_attribute_node) {
327
    if (call_attribute_node) {
328
328
329
	xmlUnlinkNode (call_attribute_node);
329
      xmlUnlinkNode (call_attribute_node);
330
        xmlFreeNode (call_attribute_node);
330
      xmlFreeNode (call_attribute_node);
331
    }
331
    }
332
    trigger_saving.emit ();
332
    trigger_saving.emit ();
333
  }
333
  }
Lines 351-364 OPENLDAP::Book::Book (Ekiga::ServiceCore &_core, Link Here
351
						      bookinfo.name).c_str ());
351
						      bookinfo.name).c_str ());
352
352
353
  uri_node = xmlNewChild (node, NULL,
353
  uri_node = xmlNewChild (node, NULL,
354
			       BAD_CAST "uri",
354
			  BAD_CAST "uri",
355
			       BAD_CAST robust_xmlEscape (node->doc,
355
			  BAD_CAST robust_xmlEscape (node->doc,
356
							  bookinfo.uri).c_str ());
356
						     bookinfo.uri).c_str ());
357
357
358
  authcID_node = xmlNewChild (node, NULL,
358
  authcID_node = xmlNewChild (node, NULL,
359
			       BAD_CAST "authcID",
359
			      BAD_CAST "authcID",
360
			       BAD_CAST robust_xmlEscape (node->doc,
360
			      BAD_CAST robust_xmlEscape (node->doc,
361
			       		bookinfo.authcID).c_str ());
361
							 bookinfo.authcID).c_str ());
362
362
363
  password_node = xmlNewChild (node, NULL,
363
  password_node = xmlNewChild (node, NULL,
364
			       BAD_CAST "password",
364
			       BAD_CAST "password",
Lines 471-652 OPENLDAP::Book::on_sasl_form_submitted (bool submitted, Link Here
471
471
472
extern "C" {
472
extern "C" {
473
473
474
typedef struct interctx {
474
  typedef struct interctx {
475
  OPENLDAP::Book *book;
475
    OPENLDAP::Book *book;
476
  std::string authcID;
476
    std::string authcID;
477
  std::string password;
477
    std::string password;
478
  std::list<std::string> results;
478
    std::list<std::string> results;
479
} interctx;
479
  } interctx;
480
480
481
static int
481
  static int
482
book_saslinter(LDAP *ld, unsigned flags __attribute__((unused)),
482
  book_saslinter(LDAP *ld, unsigned flags __attribute__((unused)),
483
  void *def, void *inter)
483
		 void *def, void *inter)
484
{
485
  sasl_interact_t *in = (sasl_interact_t *)inter;
486
  interctx *ctx = (interctx *)def;
487
  struct berval p;
488
  int i, nprompts = 0;
489
490
  /* Fill in the prompts we have info for; count
491
   * how many we're missing.
492
   */
493
  for (;in->id != SASL_CB_LIST_END;in++)
494
  {
484
  {
495
    p.bv_val = NULL;
485
    sasl_interact_t *in = (sasl_interact_t *)inter;
496
    switch(in->id)
486
    interctx *ctx = (interctx *)def;
497
    {
487
    struct berval p;
498
      case SASL_CB_GETREALM:
488
    int i, nprompts = 0;
499
        ldap_get_option(ld, LDAP_OPT_X_SASL_REALM, &p.bv_val);
489
500
        if (p.bv_val) p.bv_len = strlen(p.bv_val);
490
    /* Fill in the prompts we have info for; count
501
        break;
491
     * how many we're missing.
502
      case SASL_CB_AUTHNAME:
492
     */
503
	p.bv_len = ctx->authcID.length();
493
    for (;in->id != SASL_CB_LIST_END;in++)
504
	if (p.bv_len)
505
          p.bv_val = (char *)ctx->authcID.c_str();
506
        break;
507
      case SASL_CB_USER:
508
        /* If there was a default authcID, just ignore the authzID */
509
        if (ctx->authcID.length()) {
510
	  p.bv_val = (char *)"";
511
	  p.bv_len = 0;
512
	}
513
	break;
514
      case SASL_CB_PASS:
515
	p.bv_len = ctx->password.length();
516
	if (p.bv_len)
517
          p.bv_val = (char *)ctx->password.c_str();
518
        break;
519
      default:
520
        break;
521
    }
522
    if (p.bv_val)
523
    {
524
      in->result = p.bv_val;
525
      in->len = p.bv_len;
526
    } else
527
    {
528
      nprompts++;
529
      in->result = NULL;
530
    }
531
  }
532
533
  /* If there are missing items, try to get them all in one dialog */
534
  if (nprompts) {
535
    Ekiga::FormRequestSimple request(sigc::mem_fun (ctx->book, &OPENLDAP::Book::on_sasl_form_submitted));
536
    Ekiga::FormBuilder result;
537
    std::string prompt;
538
    std::string ctxt = "";
539
    char resbuf[32];
540
541
    request.title (_("LDAP SASL Interaction"));
542
543
    for (i=0, in = (sasl_interact_t *)inter;
544
      in->id != SASL_CB_LIST_END;in++)
545
    {
546
      bool noecho = false, challenge = false;
547
548
      if (in->result) continue;
549
550
      /* Give each dialog item a unique name */
551
      sprintf(resbuf, "res%02x", i);
552
      i++;
553
554
      /* Check for prompts that need special handling */
555
      switch(in->id)
556
      {
494
      {
557
      case SASL_CB_PASS:
495
	p.bv_val = NULL;
558
        noecho = true;
496
	switch(in->id)
559
	break;
497
	  {
560
      case SASL_CB_NOECHOPROMPT:
498
	  case SASL_CB_GETREALM:
561
        noecho = true;
499
	    ldap_get_option(ld, LDAP_OPT_X_SASL_REALM, &p.bv_val);
562
        challenge = true;
500
	    if (p.bv_val) p.bv_len = strlen(p.bv_val);
563
	break;
501
	    break;
564
      case SASL_CB_ECHOPROMPT:
502
	  case SASL_CB_AUTHNAME:
565
        challenge = true;
503
	    p.bv_len = ctx->authcID.length();
566
	break;
504
	    if (p.bv_len)
567
      default:
505
	      p.bv_val = (char *)ctx->authcID.c_str();
568
        break;
506
	    break;
507
	  case SASL_CB_USER:
508
	    /* If there was a default authcID, just ignore the authzID */
509
	    if (ctx->authcID.length()) {
510
	      p.bv_val = (char *)"";
511
	      p.bv_len = 0;
512
	    }
513
	    break;
514
	  case SASL_CB_PASS:
515
	    p.bv_len = ctx->password.length();
516
	    if (p.bv_len)
517
	      p.bv_val = (char *)ctx->password.c_str();
518
	    break;
519
	  default:
520
	    break;
521
	  }
522
	if (p.bv_val)
523
	  {
524
	    in->result = p.bv_val;
525
	    in->len = p.bv_len;
526
	  } else
527
	  {
528
	    nprompts++;
529
	    in->result = NULL;
530
	  }
569
      }
531
      }
570
532
571
      /* accumulate any challenge strings */
533
    /* If there are missing items, try to get them all in one dialog */
572
      if (challenge && in->challenge) {
534
    if (nprompts) {
573
535
      Ekiga::FormRequestSimple request(sigc::mem_fun (ctx->book, &OPENLDAP::Book::on_sasl_form_submitted));
574
	/* Translators, Howard explained : "Challenge" is a generic term
536
      Ekiga::FormBuilder result;
575
	 * in authentication. It's a prompt from the authentication mechanism
537
      std::string prompt;
576
	 * for some type of credential. Exactly what kind of challenge and
538
      std::string ctxt = "";
577
	 * what kind of credential depends on the specific authentication
539
      char resbuf[32];
578
	 * mechanism. Since SASL is a generic interface, and can dynamically
540
579
	 * load arbitrary mechanisms, there's not much more specific you can
541
      request.title (_("LDAP SASL Interaction"));
580
	 * say about it. You might google for "challenge response
542
581
	 * authentication" if you'd like more background context.
543
      for (i=0, in = (sasl_interact_t *)inter;
582
	 */
544
	   in->id != SASL_CB_LIST_END;in++)
583
        ctxt += std::string (_("Challenge: ")) +
545
	{
584
	  std::string (in->challenge) +"\n";
546
	  bool noecho = false, challenge = false;
585
      }
547
586
548
	  if (in->result) continue;
587
      /* use the provided prompt text, or our default? */
549
588
      if (in->prompt)
550
	  /* Give each dialog item a unique name */
589
        prompt = std::string (in->prompt);
551
	  sprintf(resbuf, "res%02x", i);
590
      else
552
	  i++;
591
        prompt = std::string (_("Interact"));
553
592
554
	  /* Check for prompts that need special handling */
593
      /* private text or not? */
555
	  switch(in->id)
594
      if (noecho) {
556
	    {
595
        request.private_text (std::string (resbuf), prompt, "");
557
	    case SASL_CB_PASS:
596
      } else {
558
	      noecho = true;
597
        std::string dflt;
559
	      break;
598
	if (in->defresult)
560
	    case SASL_CB_NOECHOPROMPT:
599
	  dflt = std::string (in->defresult);
561
	      noecho = true;
600
	else
562
	      challenge = true;
601
	  dflt = "";
563
	      break;
602
	request.text (std::string(resbuf), prompt, dflt);
564
	    case SASL_CB_ECHOPROMPT:
603
      }
565
	      challenge = true;
604
    }
566
	      break;
605
567
	    default:
606
    /* If we had any challenge text, set it now */
568
	      break;
607
    if (!ctxt.empty())
569
	    }
608
      request.instructions (ctxt);
570
609
571
	  /* accumulate any challenge strings */
610
    /* Save a pointer for storing the form result */
572
	  if (challenge && in->challenge) {
611
    ctx->book->saslform = &result;
573
612
    if (!ctx->book->questions.handle_request (&request)) {
574
	    /* Translators, Howard explained : "Challenge" is a generic term
613
      return LDAP_LOCAL_ERROR;
575
	     * in authentication. It's a prompt from the authentication mechanism
614
    }
576
	     * for some type of credential. Exactly what kind of challenge and
615
577
	     * what kind of credential depends on the specific authentication
616
    /* Extract answers from the result form */
578
	     * mechanism. Since SASL is a generic interface, and can dynamically
617
    for (i=0, in = (sasl_interact_t *)inter;
579
	     * load arbitrary mechanisms, there's not much more specific you can
618
      in->id != SASL_CB_LIST_END;in++)
580
	     * say about it. You might google for "challenge response
619
    {
581
	     * authentication" if you'd like more background context.
620
      bool noecho = false;
582
	     */
583
	    ctxt += std::string (_("Challenge: ")) +
584
	      std::string (in->challenge) +"\n";
585
	  }
586
587
	  /* use the provided prompt text, or our default? */
588
	  if (in->prompt)
589
	    prompt = std::string (in->prompt);
590
	  else
591
	    prompt = std::string (_("Interact"));
592
593
	  /* private text or not? */
594
	  if (noecho) {
595
	    request.private_text (std::string (resbuf), prompt, "");
596
	  } else {
597
	    std::string dflt;
598
	    if (in->defresult)
599
	      dflt = std::string (in->defresult);
600
	    else
601
	      dflt = "";
602
	    request.text (std::string(resbuf), prompt, dflt);
603
	  }
604
	}
621
605
622
      if (in->result) continue;
606
      /* If we had any challenge text, set it now */
607
      if (!ctxt.empty())
608
	request.instructions (ctxt);
623
609
624
      sprintf(resbuf, "res%02x", i);
610
      /* Save a pointer for storing the form result */
625
      i++;
611
      ctx->book->saslform = &result;
626
      switch(in->id)
612
      if (!ctx->book->questions.handle_request (&request)) {
627
      {
613
	return LDAP_LOCAL_ERROR;
628
      case SASL_CB_PASS:
629
      case SASL_CB_NOECHOPROMPT:
630
        noecho = true;
631
	break;
632
      default:
633
        break;
634
      }
614
      }
635
      if (noecho)
615
636
        prompt = result.private_text (std::string (resbuf));
616
      /* Extract answers from the result form */
637
      else
617
      for (i=0, in = (sasl_interact_t *)inter;
638
        prompt = result.text (std::string (resbuf));
618
	   in->id != SASL_CB_LIST_END;in++)
639
619
	{
640
      /* Save the answers so they don't disappear before our
620
	  bool noecho = false;
641
       * caller can see them; return the saved copies.
621
642
       */
622
	  if (in->result) continue;
643
      ctx->results.push_back (prompt);
623
644
      in->result = ctx->results.back().c_str();
624
	  sprintf(resbuf, "res%02x", i);
645
      in->len = ctx->results.back().length();
625
	  i++;
626
	  switch(in->id)
627
	    {
628
	    case SASL_CB_PASS:
629
	    case SASL_CB_NOECHOPROMPT:
630
	      noecho = true;
631
	      break;
632
	    default:
633
	      break;
634
	    }
635
	  if (noecho)
636
	    prompt = result.private_text (std::string (resbuf));
637
	  else
638
	    prompt = result.text (std::string (resbuf));
639
640
	  /* Save the answers so they don't disappear before our
641
	   * caller can see them; return the saved copies.
642
	   */
643
	  ctx->results.push_back (prompt);
644
	  in->result = ctx->results.back().c_str();
645
	  in->len = ctx->results.back().length();
646
	}
646
    }
647
    }
648
    return LDAP_SUCCESS;
647
  }
649
  }
648
  return LDAP_SUCCESS;
649
}
650
650
651
} /* extern "C" */
651
} /* extern "C" */
652
652
Lines 693-700 OPENLDAP::Book::refresh_start () Link Here
693
    ctx.authcID = bookinfo.authcID;
693
    ctx.authcID = bookinfo.authcID;
694
    ctx.password = bookinfo.password;
694
    ctx.password = bookinfo.password;
695
    result = ldap_sasl_interactive_bind_s (ldap_context, NULL,
695
    result = ldap_sasl_interactive_bind_s (ldap_context, NULL,
696
      bookinfo.saslMech.c_str(), NULL, NULL, LDAP_SASL_QUIET,
696
					   bookinfo.saslMech.c_str(), NULL, NULL, LDAP_SASL_QUIET,
697
      book_saslinter, &ctx);
697
					   book_saslinter, &ctx);
698
698
699
  } else {
699
  } else {
700
    /* Simple Bind */
700
    /* Simple Bind */
Lines 784-790 OPENLDAP::Book::refresh_bound () Link Here
784
  }
784
  }
785
  (void) ldap_msgfree (msg_entry);
785
  (void) ldap_msgfree (msg_entry);
786
786
787
sasl_bound:
787
 sasl_bound:
788
  if (!search_filter.empty ()) {
788
  if (!search_filter.empty ()) {
789
    if (search_filter[0] == '(' &&
789
    if (search_filter[0] == '(' &&
790
        search_filter[search_filter.length()-1] == ')') {
790
        search_filter[search_filter.length()-1] == ')') {
Lines 806-812 sasl_bound: Link Here
806
  }
806
  }
807
  fstr = filter.c_str();
807
  fstr = filter.c_str();
808
808
809
do_search:
809
 do_search:
810
  msgid = ldap_search_ext (ldap_context,
810
  msgid = ldap_search_ext (ldap_context,
811
			   bookinfo.urld->lud_dn,
811
			   bookinfo.urld->lud_dn,
812
			   bookinfo.urld->lud_scope,
812
			   bookinfo.urld->lud_scope,
Lines 854-870 OPENLDAP::Book::refresh_result () Link Here
854
854
855
      patience--;
855
      patience--;
856
      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
856
      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
857
			    12);
857
				   12);
858
    } else if (patience == 2) {
858
    } else if (patience == 2) {
859
859
860
      patience--;
860
      patience--;
861
      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
861
      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
862
			    21);
862
				   21);
863
    } else if (patience == 1) {
863
    } else if (patience == 1) {
864
864
865
      patience--;
865
      patience--;
866
      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
866
      Ekiga::Runtime::run_in_main (sigc::mem_fun (this, &OPENLDAP::Book::refresh_result),
867
			    30);
867
				   30);
868
    } else { // patience == 0
868
    } else { // patience == 0
869
869
870
      status = std::string (_("Could not search"));
870
      status = std::string (_("Could not search"));
Lines 929-935 OPENLDAP::BookForm (Ekiga::FormRequestSimple &request, Link Here
929
    choices["sub"] = _("Subtree");
929
    choices["sub"] = _("Subtree");
930
    choices["onelevel"] = _("Single Level");
930
    choices["onelevel"] = _("Single Level");
931
    request.single_choice ("scope", _("_Search Scope"),
931
    request.single_choice ("scope", _("_Search Scope"),
932
      scopes[info.urld->lud_scope], choices);
932
			   scopes[info.urld->lud_scope], choices);
933
  }
933
  }
934
934
935
  /* attrs[0] is the name attribute */
935
  /* attrs[0] is the name attribute */
Lines 977-983 OPENLDAP::BookForm (Ekiga::FormRequestSimple &request, Link Here
977
      }
977
      }
978
    }
978
    }
979
    request.single_choice ("saslMech", _("SASL _Mechanism"),
979
    request.single_choice ("saslMech", _("SASL _Mechanism"),
980
      info.saslMech, mechs);
980
			   info.saslMech, mechs);
981
  }
981
  }
982
}
982
}
983
983
Lines 1099-1135 OPENLDAP::Book::on_edit_form_submitted (bool submitted, Link Here
1099
  if (!submitted)
1099
  if (!submitted)
1100
    return;
1100
    return;
1101
1101
1102
  try {
1102
  std::string errmsg;
1103
    std::string errmsg;
1103
  if (OPENLDAP::BookFormInfo (result, bookinfo, errmsg)) {
1104
    if (OPENLDAP::BookFormInfo (result, bookinfo, errmsg)) {
1104
    Ekiga::FormRequestSimple request(sigc::mem_fun (this, &OPENLDAP::Book::on_edit_form_submitted));
1105
      Ekiga::FormRequestSimple request(sigc::mem_fun (this, &OPENLDAP::Book::on_edit_form_submitted));
1106
1105
1107
      result.visit (request);
1106
    result.visit (request);
1108
      request.error (errmsg);
1107
    request.error (errmsg);
1109
1108
1110
      if (!questions.handle_request (&request)) {
1109
    if (!questions.handle_request (&request)) {
1111
1110
1112
        // FIXME: better error reporting
1111
      // FIXME: better error reporting
1113
#ifdef __GNUC__
1112
#ifdef __GNUC__
1114
        std::cout << "Unhandled form request in "
1113
      std::cout << "Unhandled form request in "
1115
	          << __PRETTY_FUNCTION__ << std::endl;
1114
		<< __PRETTY_FUNCTION__ << std::endl;
1116
#endif
1115
#endif
1117
      }
1118
      return;
1119
    }
1116
    }
1117
    return;
1118
  }
1120
1119
1121
    robust_xmlNodeSetContent (node, &name_node, "name", bookinfo.name);
1120
  robust_xmlNodeSetContent (node, &name_node, "name", bookinfo.name);
1122
1123
    robust_xmlNodeSetContent (node, &uri_node, "uri", bookinfo.uri);
1124
1125
    robust_xmlNodeSetContent (node, &authcID_node, "authcID", bookinfo.authcID);
1126
1121
1127
    robust_xmlNodeSetContent (node, &password_node, "password", bookinfo.password);
1122
  robust_xmlNodeSetContent (node, &uri_node, "uri", bookinfo.uri);
1128
    updated.emit ();
1129
    trigger_saving.emit ();
1130
1123
1131
  } catch (Ekiga::Form::not_found) {
1124
  robust_xmlNodeSetContent (node, &authcID_node, "authcID", bookinfo.authcID);
1132
1125
1133
    std::cerr << "Invalid result form" << std::endl; // FIXME: do better
1126
  robust_xmlNodeSetContent (node, &password_node, "password", bookinfo.password);
1134
  }
1127
  updated.emit ();
1128
  trigger_saving.emit ();
1135
}
1129
}
(-)a/lib/engine/components/ldap/ldap-source.cpp (-20 / +14 lines)
Lines 141-147 OPENLDAP::Source::new_book () Link Here
141
141
142
  bookinfo.name = "";
142
  bookinfo.name = "";
143
  bookinfo.uri = "ldap://localhost/dc=net?cn,telephoneNumber?sub?(cn=$)",
143
  bookinfo.uri = "ldap://localhost/dc=net?cn,telephoneNumber?sub?(cn=$)",
144
  bookinfo.authcID = "";
144
    bookinfo.authcID = "";
145
  bookinfo.password = "";
145
  bookinfo.password = "";
146
  bookinfo.saslMech = "";
146
  bookinfo.saslMech = "";
147
  bookinfo.urld = NULL;
147
  bookinfo.urld = NULL;
Lines 185-217 OPENLDAP::Source::on_new_book_form_submitted (bool submitted, Link Here
185
  if (!submitted)
185
  if (!submitted)
186
    return;
186
    return;
187
187
188
  try {
188
  std::string errmsg;
189
    std::string errmsg;
190
189
191
    if (OPENLDAP::BookFormInfo (result, bookinfo, errmsg)) {
190
  if (OPENLDAP::BookFormInfo (result, bookinfo, errmsg)) {
192
      Ekiga::FormRequestSimple request(sigc::mem_fun (this, &OPENLDAP::Source::on_new_book_form_submitted));
191
    Ekiga::FormRequestSimple request(sigc::mem_fun (this, &OPENLDAP::Source::on_new_book_form_submitted));
193
192
194
      result.visit (request);
193
    result.visit (request);
195
      request.error (errmsg);
194
    request.error (errmsg);
196
195
197
      if (!questions.handle_request (&request)) {
196
    if (!questions.handle_request (&request)) {
198
197
199
        // FIXME: better error reporting
198
      // FIXME: better error reporting
200
#ifdef __GNUC__
199
#ifdef __GNUC__
201
        std::cout << "Unhandled form request in "
200
      std::cout << "Unhandled form request in "
202
	          << __PRETTY_FUNCTION__ << std::endl;
201
		<< __PRETTY_FUNCTION__ << std::endl;
203
#endif
202
#endif
204
      }
205
      return;
206
    }
203
    }
207
204
    return;
208
    add ();
209
    save ();
210
211
  } catch (Ekiga::Form::not_found) {
212
213
    std::cerr << "Invalid result form" << std::endl; // FIXME: do better
214
  }
205
  }
206
207
  add ();
208
  save ();
215
}
209
}
216
210
217
void
211
void
(-)a/lib/engine/components/local-roster/local-heap.cpp (-53 / +36 lines)
Lines 246-252 Local::Heap::new_presentity (const std::string name, Link Here
246
246
247
    if (!questions.handle_request (&request)) {
247
    if (!questions.handle_request (&request)) {
248
248
249
    // FIXME: better error reporting
249
      // FIXME: better error reporting
250
#ifdef __GNUC__
250
#ifdef __GNUC__
251
      std::cout << "Unhandled form request in "
251
      std::cout << "Unhandled form request in "
252
		<< __PRETTY_FUNCTION__ << std::endl;
252
		<< __PRETTY_FUNCTION__ << std::endl;
Lines 288-295 Local::Heap::push_presence (const std::string uri, Link Here
288
struct push_status_helper
288
struct push_status_helper
289
{
289
{
290
  push_status_helper (const std::string uri_,
290
  push_status_helper (const std::string uri_,
291
			const std::string status_): uri(uri_),
291
		      const std::string status_): uri(uri_),
292
						    status(status_)
292
						  status(status_)
293
  {}
293
  {}
294
294
295
  bool test (Local::PresentityPtr presentity)
295
  bool test (Local::PresentityPtr presentity)
Lines 383-434 Local::Heap::new_presentity_form_submitted (bool submitted, Link Here
383
  if (!submitted)
383
  if (!submitted)
384
    return;
384
    return;
385
385
386
  try {
386
  gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
387
  const std::string name = result.text ("name");
388
  const std::string good_uri = result.hidden ("good-uri");
389
  std::string uri;
390
  const std::set<std::string> groups = result.editable_set ("groups");
391
392
  if (good_uri == "yes")
393
    uri = result.hidden ("uri");
394
  else
395
    uri = result.text ("uri");
396
397
  size_t pos = uri.find_first_of (' ');
398
  if (pos != std::string::npos)
399
    uri = uri.substr (0, pos);
400
  if (presence_core->is_supported_uri (uri)
401
      && !has_presentity_with_uri (uri)) {
402
403
    add (name, uri, groups);
404
    save ();
405
  } else {
387
406
388
    gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
407
    Ekiga::FormRequestSimple request(sigc::mem_fun (this, &Local::Heap::new_presentity_form_submitted));
389
    const std::string name = result.text ("name");
390
    const std::string good_uri = result.hidden ("good-uri");
391
    std::string uri;
392
    const std::set<std::string> groups = result.editable_set ("groups");
393
408
394
    if (good_uri == "yes")
409
    result.visit (request);
395
      uri = result.hidden ("uri");
410
    if (!presence_core->is_supported_uri (uri))
411
      request.error (_("You supplied an unsupported address"));
396
    else
412
    else
397
      uri = result.text ("uri");
413
      request.error (_("You already have a contact with this address!"));
398
399
    size_t pos = uri.find_first_of (' ');
400
    if (pos != std::string::npos)
401
      uri = uri.substr (0, pos);
402
    if (presence_core->is_supported_uri (uri)
403
	&& !has_presentity_with_uri (uri)) {
404
414
405
      add (name, uri, groups);
415
    if (!questions.handle_request (&request)) {
406
      save ();
407
    } else {
408
409
      Ekiga::FormRequestSimple request(sigc::mem_fun (this, &Local::Heap::new_presentity_form_submitted));
410
411
      result.visit (request);
412
      if (!presence_core->is_supported_uri (uri))
413
	request.error (_("You supplied an unsupported address"));
414
      else
415
	request.error (_("You already have a contact with this address!"));
416
417
      if (!questions.handle_request (&request)) {
418
416
419
	// FIXME: better error handling
417
      // FIXME: better error handling
420
#ifdef __GNUC__
418
#ifdef __GNUC__
421
	std::cout << "Unhandled form request in "
419
      std::cout << "Unhandled form request in "
422
		  << __PRETTY_FUNCTION__ << std::endl;
420
		<< __PRETTY_FUNCTION__ << std::endl;
423
#endif
421
#endif
424
      }
425
    }
422
    }
426
  } catch (Ekiga::Form::not_found) {
427
428
#ifdef __GNUC__
429
    std::cerr << "Invalid form submitted to "
430
	      << __PRETTY_FUNCTION__ << std::endl;
431
#endif
432
  }
423
  }
433
}
424
}
434
425
Lines 477-495 Local::Heap::rename_group_form_submitted (std::string old_name, Link Here
477
  if (!submitted)
468
  if (!submitted)
478
    return;
469
    return;
479
470
480
  try {
471
  const std::string new_name = result.text ("name");
481
    const std::string new_name = result.text ("name");
482
472
483
    if ( !new_name.empty () && new_name != old_name) {
473
  if ( !new_name.empty () && new_name != old_name) {
484
474
485
      rename_group_form_submitted_helper helper (old_name, new_name);
475
    rename_group_form_submitted_helper helper (old_name, new_name);
486
      visit_presentities (sigc::mem_fun (helper, &rename_group_form_submitted_helper::rename_group));
476
    visit_presentities (sigc::mem_fun (helper, &rename_group_form_submitted_helper::rename_group));
487
    }
488
  } catch (Ekiga::Form::not_found) {
489
490
#ifdef __GNUC__
491
    std::cerr << "Invalid form submitted to "
492
	      << __PRETTY_FUNCTION__ << std::endl;
493
#endif
494
  }
477
  }
495
}
478
}
(-)a/lib/engine/components/local-roster/local-presentity.cpp (-55 / +45 lines)
Lines 247-316 Local::Presentity::edit_presentity_form_submitted (bool submitted, Link Here
247
  if (!submitted)
247
  if (!submitted)
248
    return;
248
    return;
249
249
250
  try {
250
  const std::string new_name = result.text ("name");
251
251
  const std::set<std::string> new_groups = result.editable_set ("groups");
252
    /* we first fetch all data before making any change, so if there's
252
  std::string new_uri = result.text ("uri");
253
     * a problem, we don't do anything */
253
  std::map<std::string, xmlNodePtr> future_group_nodes;
254
    const std::string new_name = result.text ("name");
254
  size_t pos = new_uri.find_first_of (' ');
255
    const std::set<std::string> new_groups = result.editable_set ("groups");
255
  if (pos != std::string::npos)
256
    std::string new_uri = result.text ("uri");
256
    new_uri = new_uri.substr (0, pos);
257
    std::map<std::string, xmlNodePtr> future_group_nodes;
257
258
    size_t pos = new_uri.find_first_of (' ');
258
  name = new_name;
259
    if (pos != std::string::npos)
259
  if (uri != new_uri) {
260
      new_uri = new_uri.substr (0, pos);
260
261
261
    gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
262
    name = new_name;
262
    presence_core->unfetch_presence (uri);
263
    if (uri != new_uri) {
263
    uri = new_uri;
264
264
    presence = "unknown";
265
      gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
265
    presence_core->fetch_presence (uri);
266
      presence_core->unfetch_presence (uri);
266
    xmlSetProp (node, (const xmlChar*)"uri", (const xmlChar*)uri.c_str ());
267
      uri = new_uri;
267
  }
268
      presence = "unknown";
269
      presence_core->fetch_presence (uri);
270
      xmlSetProp (node, (const xmlChar*)"uri", (const xmlChar*)uri.c_str ());
271
    }
272
268
273
    robust_xmlNodeSetContent (node, &name_node, "name", name);
269
  robust_xmlNodeSetContent (node, &name_node, "name", name);
274
270
275
    // the first loop looks at groups we were in : are we still in ?
271
  // the first loop looks at groups we were in : are we still in ?
276
    for (std::map<std::string, xmlNodePtr>::const_iterator iter
272
  for (std::map<std::string, xmlNodePtr>::const_iterator iter
277
	   = group_nodes.begin ();
273
	 = group_nodes.begin ();
278
	 iter != group_nodes.end () ;
274
       iter != group_nodes.end () ;
279
	 iter++) {
275
       iter++) {
280
276
281
      if (new_groups.find (iter->first) == new_groups.end ()) {
277
    if (new_groups.find (iter->first) == new_groups.end ()) {
282
278
283
	xmlUnlinkNode (iter->second);
279
      xmlUnlinkNode (iter->second);
284
	xmlFreeNode (iter->second);
280
      xmlFreeNode (iter->second);
285
      } 
286
      else {
287
	future_group_nodes[iter->first] = iter->second;
288
      }
289
    }
281
    }
290
282
    else {
291
    // the second loop looking for groups we weren't in but are now
283
      future_group_nodes[iter->first] = iter->second;
292
    for (std::set<std::string>::const_iterator iter = new_groups.begin ();
293
	 iter != new_groups.end ();
294
	 iter++) {
295
296
      if (std::find (groups.begin (), groups.end (), *iter) == groups.end ())
297
	future_group_nodes[*iter] = xmlNewChild (node, NULL,
298
						 BAD_CAST "group",
299
						 BAD_CAST robust_xmlEscape (node->doc, *iter).c_str ());
300
    }
284
    }
285
  }
301
286
302
    // ok, now we know our groups
287
  // the second loop looking for groups we weren't in but are now
303
    group_nodes = future_group_nodes;
288
  for (std::set<std::string>::const_iterator iter = new_groups.begin ();
304
    groups = new_groups;
289
       iter != new_groups.end ();
290
       iter++) {
305
291
306
    updated.emit ();
292
    if (std::find (groups.begin (), groups.end (), *iter) == groups.end ())
307
    trigger_saving.emit ();
293
      future_group_nodes[*iter] = xmlNewChild (node, NULL,
308
  } catch (Ekiga::Form::not_found) {
294
					       BAD_CAST "group",
309
#ifdef __GNUC__
295
					       BAD_CAST robust_xmlEscape (node->doc, *iter).c_str ());
310
    std::cerr << "Invalid form submitted to "
311
	      << __PRETTY_FUNCTION__ << std::endl;
312
#endif
313
  }
296
  }
297
298
  // ok, now we know our groups
299
  group_nodes = future_group_nodes;
300
  groups = new_groups;
301
302
  updated.emit ();
303
  trigger_saving.emit ();
314
}
304
}
315
305
316
306
(-)a/lib/engine/components/opal/opal-account.cpp (-71 / +64 lines)
Lines 53-59 Link Here
53
53
54
Opal::Account::Account (Ekiga::ServiceCore & _core,
54
Opal::Account::Account (Ekiga::ServiceCore & _core,
55
                        const std::string & account)
55
                        const std::string & account)
56
: core (_core)
56
  : core (_core)
57
{
57
{
58
  dead = false;
58
  dead = false;
59
  active = false;
59
  active = false;
Lines 119-125 Opal::Account::Account (Ekiga::ServiceCore & _core, Link Here
119
    type = Account::DiamondCard;
119
    type = Account::DiamondCard;
120
  else if (protocol_name == "SIP")
120
  else if (protocol_name == "SIP")
121
    type = Account::SIP;
121
    type = Account::SIP;
122
  else 
122
  else
123
    type = Account::H323;
123
    type = Account::H323;
124
124
125
  registration_event.connect (sigc::mem_fun (this, &Opal::Account::on_registration_event));
125
  registration_event.connect (sigc::mem_fun (this, &Opal::Account::on_registration_event));
Lines 128-141 Opal::Account::Account (Ekiga::ServiceCore & _core, Link Here
128
128
129
Opal::Account::Account (Ekiga::ServiceCore & _core,
129
Opal::Account::Account (Ekiga::ServiceCore & _core,
130
                        Type t,
130
                        Type t,
131
                        std::string _name, 
131
                        std::string _name,
132
                        std::string _host,
132
                        std::string _host,
133
                        std::string _username,
133
                        std::string _username,
134
                        std::string _auth_username,
134
                        std::string _auth_username,
135
                        std::string _password,
135
                        std::string _password,
136
                        bool _enabled,
136
                        bool _enabled,
137
                        unsigned _timeout)
137
                        unsigned _timeout)
138
: core (_core)
138
  : core (_core)
139
{
139
{
140
  dead = false;
140
  dead = false;
141
  active = false;
141
  active = false;
Lines 169-184 const std::string Opal::Account::as_string () const Link Here
169
169
170
  std::stringstream str;
170
  std::stringstream str;
171
171
172
  str << enabled << "|1|" 
172
  str << enabled << "|1|"
173
      << aid << "|" 
173
      << aid << "|"
174
      << name << "|" 
174
      << name << "|"
175
      << protocol_name << "|" 
175
      << protocol_name << "|"
176
      << host << "|" 
176
      << host << "|"
177
      << host << "|" 
177
      << host << "|"
178
      << username << "|" 
178
      << username << "|"
179
      << auth_username << "|" 
179
      << auth_username << "|"
180
      << (password.empty () ? " " : password) << "|" 
180
      << (password.empty () ? " " : password) << "|"
181
      << timeout; 
181
      << timeout;
182
182
183
  return str.str ();
183
  return str.str ();
184
}
184
}
Lines 314-336 bool Opal::Account::populate_menu (Ekiga::MenuBuilder &builder) Link Here
314
314
315
    std::stringstream str;
315
    std::stringstream str;
316
    std::stringstream url;
316
    std::stringstream url;
317
    str << "https://www.diamondcard.us/exec/voip-login?accId=" << get_username () << "&pinCode=" << get_password () << "&spo=ekiga"; 
317
    str << "https://www.diamondcard.us/exec/voip-login?accId=" << get_username () << "&pinCode=" << get_password () << "&spo=ekiga";
318
318
319
    builder.add_separator ();
319
    builder.add_separator ();
320
320
321
    url.str ("");
321
    url.str ("");
322
    url << str.str () << "&act=rch";
322
    url << str.str () << "&act=rch";
323
    builder.add_action ("recharge",
323
    builder.add_action ("recharge",
324
			 _("Recharge the account"),
324
			_("Recharge the account"),
325
                        sigc::bind (sigc::mem_fun (this, &Opal::Account::on_consult), url.str ()));
325
                        sigc::bind (sigc::mem_fun (this, &Opal::Account::on_consult), url.str ()));
326
    url.str ("");
326
    url.str ("");
327
    url << str.str () << "&act=bh";
327
    url << str.str () << "&act=bh";
328
    builder.add_action ("balance", 
328
    builder.add_action ("balance",
329
                        _("Consult the balance history"),
329
                        _("Consult the balance history"),
330
                        sigc::bind (sigc::mem_fun (this, &Opal::Account::on_consult), url.str ()));
330
                        sigc::bind (sigc::mem_fun (this, &Opal::Account::on_consult), url.str ()));
331
    url.str ("");
331
    url.str ("");
332
    url << str.str () << "&act=ch";
332
    url << str.str () << "&act=ch";
333
    builder.add_action ("history", 
333
    builder.add_action ("history",
334
                        _("Consult the call history"),
334
                        _("Consult the call history"),
335
                        sigc::bind (sigc::mem_fun (this, &Opal::Account::on_consult), url.str ()));
335
                        sigc::bind (sigc::mem_fun (this, &Opal::Account::on_consult), url.str ()));
336
  }
336
  }
Lines 345-351 void Opal::Account::edit () Link Here
345
  std::stringstream str;
345
  std::stringstream str;
346
346
347
  str << get_timeout ();
347
  str << get_timeout ();
348
  
348
349
  request.title (_("Edit account"));
349
  request.title (_("Edit account"));
350
350
351
  request.instructions (_("Please update the following fields:"));
351
  request.instructions (_("Please update the following fields:"));
Lines 382-443 void Opal::Account::on_edit_form_submitted (bool submitted, Link Here
382
  if (!submitted)
382
  if (!submitted)
383
    return;
383
    return;
384
384
385
  try {
385
  std::string new_name = result.text ("name");
386
386
  std::string new_host = result.text ("host");
387
    std::string new_name = result.text ("name");
387
  std::string new_user = result.text ("user");
388
    std::string new_host = result.text ("host");
388
  std::string new_authentication_user;
389
    std::string new_user = result.text ("user");
389
  if (get_protocol_name () == "SIP")
390
    std::string new_authentication_user;
390
    new_authentication_user = result.text ("authentication_user");
391
    if (get_protocol_name () == "SIP")
391
  if (new_authentication_user.empty ())
392
      new_authentication_user = result.text ("authentication_user");
392
    new_authentication_user = new_user;
393
    if (new_authentication_user.empty ())
393
  std::string new_password = result.private_text ("password");
394
      new_authentication_user = new_user;
394
  bool new_enabled = result.boolean ("enabled");
395
    std::string new_password = result.private_text ("password");
395
  unsigned new_timeout = atoi (result.text ("timeout").c_str ());
396
    bool new_enabled = result.boolean ("enabled");
396
  std::string error;
397
    unsigned new_timeout = atoi (result.text ("timeout").c_str ());
397
398
    std::string error;
398
  if (new_name.empty ())
399
399
    error = _("You did not supply a name for that account.");
400
    if (new_name.empty ()) 
400
  else if (new_host.empty ())
401
      error = _("You did not supply a name for that account.");
401
    error = _("You did not supply a host to register to.");
402
    else if (new_host.empty ()) 
402
  else if (new_user.empty ())
403
      error = _("You did not supply a host to register to.");
403
    error = _("You did not supply a user name for that account.");
404
    else if (new_user.empty ())
404
  else if (new_timeout < 10)
405
      error = _("You did not supply a user name for that account.");
405
    error = _("The timeout should have a bigger value.");
406
    else if (new_timeout < 10)
406
407
      error = _("The timeout should have a bigger value.");
407
  if (!error.empty ()) {
408
408
409
    if (!error.empty ()) {
409
    Ekiga::FormRequestSimple request(sigc::mem_fun (this, &Opal::Account::on_edit_form_submitted));
410
410
    result.visit (request);
411
      Ekiga::FormRequestSimple request(sigc::mem_fun (this, &Opal::Account::on_edit_form_submitted));
411
    request.error (error);
412
      result.visit (request);
412
413
      request.error (error);
413
    if (!questions.handle_request (&request)) {
414
415
      if (!questions.handle_request (&request)) {
416
#ifdef __GNUC__
414
#ifdef __GNUC__
417
        std::cout << "Unhandled form request in "
415
      std::cout << "Unhandled form request in "
418
          << __PRETTY_FUNCTION__ << std::endl;
416
		<< __PRETTY_FUNCTION__ << std::endl;
419
#endif
417
#endif
420
      }
421
    }
422
    else {
423
424
      disable ();
425
      name = new_name;
426
      host = new_host;
427
      username = new_user;
428
      auth_username = new_authentication_user;
429
      password = new_password;
430
      timeout = new_timeout;
431
      enabled = new_enabled;
432
      enable ();
433
434
      updated.emit ();
435
      trigger_saving.emit ();
436
    }
418
    }
419
  }
420
  else {
421
422
    disable ();
423
    name = new_name;
424
    host = new_host;
425
    username = new_user;
426
    auth_username = new_authentication_user;
427
    password = new_password;
428
    timeout = new_timeout;
429
    enabled = new_enabled;
430
    enable ();
437
431
438
  } catch (Ekiga::Form::not_found) {
432
    updated.emit ();
439
433
    trigger_saving.emit ();
440
    std::cerr << "Invalid result form" << std::endl; // FIXME: do better
441
  }
434
  }
442
}
435
}
443
436
(-)a/lib/engine/components/opal/opal-bank.cpp (-44 / +37 lines)
Lines 158-211 void Opal::Bank::on_new_account_form_submitted (bool submitted, Link Here
158
  if (!submitted)
158
  if (!submitted)
159
    return;
159
    return;
160
160
161
  try {
161
  Ekiga::FormRequestSimple request(sigc::bind (sigc::mem_fun (this, &Opal::Bank::on_new_account_form_submitted) ,acc_type));
162
162
163
    Ekiga::FormRequestSimple request(sigc::bind (sigc::mem_fun (this, &Opal::Bank::on_new_account_form_submitted) ,acc_type));
163
  std::string error;
164
164
  std::string new_name = (acc_type == Opal::Account::SIP
165
    std::string error;
165
			  || acc_type == Opal::Account::H323) ? result.text ("name") : result.hidden ("name");
166
    std::string new_name = (acc_type == Opal::Account::SIP
166
  std::string new_host = (acc_type == Opal::Account::SIP
167
			    || acc_type == Opal::Account::H323) ? result.text ("name") : result.hidden ("name");
167
			  || acc_type == Opal::Account::H323) ? result.text ("host") : result.hidden ("host");
168
    std::string new_host = (acc_type == Opal::Account::SIP
168
  std::string new_user = result.text ("user");
169
			    || acc_type == Opal::Account::H323) ? result.text ("host") : result.hidden ("host");
169
  std::string new_authentication_user = (acc_type == Opal::Account::SIP) ? result.text ("authentication_user") : new_user;
170
    std::string new_user = result.text ("user");
170
  std::string new_password = result.private_text ("password");
171
    std::string new_authentication_user = (acc_type == Opal::Account::SIP) ? result.text ("authentication_user") : new_user;
171
  bool new_enabled = result.boolean ("enabled");
172
    std::string new_password = result.private_text ("password");
172
  unsigned new_timeout = atoi ((acc_type == Opal::Account::SIP
173
    bool new_enabled = result.boolean ("enabled");
173
				|| acc_type == Opal::Account::H323) ?
174
    unsigned new_timeout = atoi ((acc_type == Opal::Account::SIP
174
			       result.text ("timeout").c_str () : result.hidden ("timeout").c_str ());
175
				  || acc_type == Opal::Account::H323) ?
175
176
                                 result.text ("timeout").c_str () : result.hidden ("timeout").c_str ());
176
  result.visit (request);
177
177
178
    result.visit (request);
178
  if (new_name.empty ())
179
179
    error = _("You did not supply a name for that account.");
180
    if (new_name.empty ())
180
  else if (new_host.empty ())
181
      error = _("You did not supply a name for that account.");
181
    error = _("You did not supply a host to register to.");
182
    else if (new_host.empty ())
182
  else if (new_user.empty ())
183
      error = _("You did not supply a host to register to.");
183
    error = _("You did not supply a user name for that account.");
184
    else if (new_user.empty ())
184
  else if (new_timeout < 10)
185
      error = _("You did not supply a user name for that account.");
185
    error = _("The timeout should have a bigger value.");
186
    else if (new_timeout < 10)
186
187
      error = _("The timeout should have a bigger value.");
187
  if (!error.empty ()) {
188
188
    request.error (error);
189
    if (!error.empty ()) {
189
190
      request.error (error);
190
    if (!questions.handle_request (&request)) {
191
192
      if (!questions.handle_request (&request)) {
193
#ifdef __GNUC__
191
#ifdef __GNUC__
194
        std::cout << "Unhandled form request in "
192
      std::cout << "Unhandled form request in "
195
		  << __PRETTY_FUNCTION__ << std::endl;
193
		<< __PRETTY_FUNCTION__ << std::endl;
196
#endif
194
#endif
197
      }
198
    }
195
    }
199
    else {
196
  }
200
197
  else {
201
      add (acc_type, new_name, new_host, new_user, new_authentication_user,
202
	   new_password, new_enabled, new_timeout);
203
      save ();
204
    }
205
206
  } catch (Ekiga::Form::not_found) {
207
198
208
    std::cerr << "Invalid result form" << std::endl;
199
    add (acc_type, new_name, new_host, new_user, new_authentication_user,
200
	 new_password, new_enabled, new_timeout);
201
    save ();
209
  }
202
  }
210
}
203
}
211
204
(-)a/lib/engine/components/resource-list/rl-cluster.cpp (-17 / +8 lines)
Lines 190-212 RL::Cluster::on_new_heap_form_submitted (bool submitted, Link Here
190
  if (!submitted)
190
  if (!submitted)
191
    return;
191
    return;
192
192
193
  try {
193
  const std::string name = result.text ("name");
194
194
  const std::string uri = result.text ("uri");
195
    const std::string name = result.text ("name");
195
  const std::string username = result.text ("username");
196
    const std::string uri = result.text ("uri");
196
  const std::string password = result.private_text ("password");
197
    const std::string username = result.text ("username");
197
  const std::string user = result.text ("user");
198
    const std::string password = result.private_text ("password");
198
  bool writable = result.boolean ("writable");
199
    const std::string user = result.text ("user");
199
200
    bool writable = result.boolean ("writable");
200
  add (name, uri, username, password, user, writable);
201
202
    add (name, uri, username, password, user, writable);
203
  } catch (Ekiga::Form::not_found) {
204
205
#ifdef __GNUC__
206
    std::cerr << "Invalid form submitted to "
207
	      << __PRETTY_FUNCTION__ << std::endl;
208
#endif
209
  }
210
}
201
}
211
202
212
203
(-)a/lib/engine/components/resource-list/rl-heap.cpp (-91 / +79 lines)
Lines 491-522 RL::Heap::on_edit_form_submitted (bool submitted, Link Here
491
  if (!submitted)
491
  if (!submitted)
492
    return;
492
    return;
493
493
494
  try {
494
  std::string name_str = result.text ("name");
495
495
  std::string root_str = result.text ("root");
496
    std::string name_str = result.text ("name");
496
  std::string user_str = result.text ("user");
497
    std::string root_str = result.text ("root");
497
  std::string username_str = result.text ("username");
498
    std::string user_str = result.text ("user");
498
  std::string password_str = result.private_text ("password");
499
    std::string username_str = result.text ("username");
499
  bool writable = result.boolean ("writable");
500
    std::string password_str = result.private_text ("password");
500
501
    bool writable = result.boolean ("writable");
501
  if (writable)
502
502
    xmlSetProp (node, BAD_CAST "writable", BAD_CAST "1");
503
    if (writable)
503
  else
504
      xmlSetProp (node, BAD_CAST "writable", BAD_CAST "1");
504
    xmlSetProp (node, BAD_CAST "writable", BAD_CAST "0");
505
    else
505
  robust_xmlNodeSetContent (node, &name, "name", name_str);
506
      xmlSetProp (node, BAD_CAST "writable", BAD_CAST "0");
506
  robust_xmlNodeSetContent (node, &root, "root", root_str);
507
    robust_xmlNodeSetContent (node, &name, "name", name_str);
507
  robust_xmlNodeSetContent (node, &user, "user", user_str);
508
    robust_xmlNodeSetContent (node, &root, "root", root_str);
508
  robust_xmlNodeSetContent (node, &username, "username", username_str);
509
    robust_xmlNodeSetContent (node, &user, "user", user_str);
509
  robust_xmlNodeSetContent (node, &password, "password", password_str);
510
    robust_xmlNodeSetContent (node, &username, "username", username_str);
510
511
    robust_xmlNodeSetContent (node, &password, "password", password_str);
511
  trigger_saving.emit ();
512
512
  updated.emit ();
513
    trigger_saving.emit ();
513
  refresh ();
514
    updated.emit ();
515
    refresh ();
516
  } catch (Ekiga::Form::not_found) {
517
518
    std::cerr << "Invalid result form" << std::endl; // FIXME: do better
519
  }
520
}
514
}
521
515
522
void
516
void
Lines 560-638 RL::Heap::on_new_entry_form_submitted (bool submitted, Link Here
560
  if (!submitted)
554
  if (!submitted)
561
    return;
555
    return;
562
556
563
  try {
557
  std::string entry_name = result.text ("name");
564
558
  std::string entry_uri = result.text ("uri");
565
    std::string entry_name = result.text ("name");
559
  std::set<std::string> entry_groups = result.editable_set ("groups");
566
    std::string entry_uri = result.text ("uri");
560
567
    std::set<std::string> entry_groups = result.editable_set ("groups");
561
  xmlNodePtr entry_node = xmlNewChild (list_node, NULL,
568
562
				       BAD_CAST "entry", NULL);
569
    xmlNodePtr entry_node = xmlNewChild (list_node, NULL,
563
  xmlSetProp (entry_node, BAD_CAST "uri",
570
					 BAD_CAST "entry", NULL);
564
	      BAD_CAST robust_xmlEscape (doc.get (), entry_uri).c_str ());
571
    xmlSetProp (entry_node, BAD_CAST "uri",
565
  xmlNewChild (entry_node, NULL, BAD_CAST "display-name",
572
		BAD_CAST robust_xmlEscape (doc.get (), entry_uri).c_str ());
566
	       BAD_CAST robust_xmlEscape (doc.get (), entry_name).c_str ());
573
    xmlNewChild (entry_node, NULL, BAD_CAST "display-name",
567
  xmlNsPtr ns = xmlSearchNsByHref (doc.get (), entry_node,
574
		 BAD_CAST robust_xmlEscape (doc.get (), entry_name).c_str ());
568
				   BAD_CAST "http://www.ekiga.org");
575
    xmlNsPtr ns = xmlSearchNsByHref (doc.get (), entry_node,
569
  if (ns == NULL) {
576
				     BAD_CAST "http://www.ekiga.org");
570
577
    if (ns == NULL) {
571
    // FIXME: we should handle the case, even if it shouldn't happen
578
572
  }
579
      // FIXME: we should handle the case, even if it shouldn't happen
580
    }
581
573
582
    for (std::set<std::string>::const_iterator iter = entry_groups.begin ();
574
  for (std::set<std::string>::const_iterator iter = entry_groups.begin ();
583
	 iter != entry_groups.end ();
575
       iter != entry_groups.end ();
584
	 ++iter) {
576
       ++iter) {
585
577
586
      xmlNewChild (entry_node, ns, BAD_CAST "group",
578
    xmlNewChild (entry_node, ns, BAD_CAST "group",
587
		   BAD_CAST robust_xmlEscape (doc.get (), *iter).c_str ());
579
		 BAD_CAST robust_xmlEscape (doc.get (), *iter).c_str ());
588
    }
580
  }
589
581
590
    xmlBufferPtr buffer = xmlBufferCreate ();
582
  xmlBufferPtr buffer = xmlBufferCreate ();
591
    int res = xmlNodeDump (buffer, doc.get (), entry_node, 0, 0);
583
  int res = xmlNodeDump (buffer, doc.get (), entry_node, 0, 0);
592
584
593
    if (res >= 0) {
585
  if (res >= 0) {
594
586
595
      std::string root_str;
587
    std::string root_str;
596
      std::string username_str;
588
    std::string username_str;
597
      std::string password_str;
589
    std::string password_str;
598
      std::string user_str;
590
    std::string user_str;
599
591
600
      {
592
    {
601
	xmlChar* str = xmlNodeGetContent (root);
593
      xmlChar* str = xmlNodeGetContent (root);
602
	if (str != NULL)
594
      if (str != NULL)
603
	  root_str = (const char*)str;
595
	root_str = (const char*)str;
604
      }
605
      {
606
	xmlChar* str = xmlNodeGetContent (user);
607
	if (str != NULL)
608
	  user_str = (const char*)str;
609
      }
610
      {
611
	xmlChar* str = xmlNodeGetContent (username);
612
	if (str != NULL)
613
	  username_str = (const char*)str;
614
      }
615
      {
616
	xmlChar* str = xmlNodeGetContent (password);
617
	if (str != NULL)
618
	  password_str = (const char*)str;
619
      }
620
      gmref_ptr<XCAP::Path> path(new XCAP::Path (root_str, "resource-lists",
621
						 user_str));
622
      path->set_credentials (username_str, password_str);
623
      path = path->build_child ("resource-lists");
624
      path = path->build_child ("list");
625
      path = path->build_child_with_attribute ("entry", "uri", entry_uri);
626
      gmref_ptr<XCAP::Core> xcap(services.get ("xcap-core"));
627
      xcap->write (path, "application/xcap-el+xml",
628
		   (const char*)xmlBufferContent (buffer),
629
		   sigc::mem_fun (this, &RL::Heap::new_entry_result));
630
    }
596
    }
631
    xmlBufferFree (buffer);
597
    {
632
  } catch (Ekiga::Form::not_found exc) {
598
      xmlChar* str = xmlNodeGetContent (user);
633
599
      if (str != NULL)
634
    std::cerr << "Invalid result form" << std::endl; // FIXME: do better
600
	user_str = (const char*)str;
601
    }
602
    {
603
      xmlChar* str = xmlNodeGetContent (username);
604
      if (str != NULL)
605
	username_str = (const char*)str;
606
    }
607
    {
608
      xmlChar* str = xmlNodeGetContent (password);
609
      if (str != NULL)
610
	password_str = (const char*)str;
611
    }
612
    gmref_ptr<XCAP::Path> path(new XCAP::Path (root_str, "resource-lists",
613
					       user_str));
614
    path->set_credentials (username_str, password_str);
615
    path = path->build_child ("resource-lists");
616
    path = path->build_child ("list");
617
    path = path->build_child_with_attribute ("entry", "uri", entry_uri);
618
    gmref_ptr<XCAP::Core> xcap(services.get ("xcap-core"));
619
    xcap->write (path, "application/xcap-el+xml",
620
		 (const char*)xmlBufferContent (buffer),
621
		 sigc::mem_fun (this, &RL::Heap::new_entry_result));
635
  }
622
  }
623
  xmlBufferFree (buffer);
636
}
624
}
637
625
638
void
626
void
(-)a/lib/engine/components/resource-list/rl-presentity.cpp (-46 / +38 lines)
Lines 73-79 RL::Presentity::Presentity (Ekiga::ServiceCore &services_, Link Here
73
  } else {
73
  } else {
74
74
75
    // FIXME: we should handle the case, even if it shouldn't happen
75
    // FIXME: we should handle the case, even if it shouldn't happen
76
  
76
77
  }
77
  }
78
78
79
  for (xmlNodePtr child = node->children ;
79
  for (xmlNodePtr child = node->children ;
Lines 216-222 RL::Presentity::edit_presentity () Link Here
216
{
216
{
217
  Ekiga::FormRequestSimple request(sigc::mem_fun (this, &RL::Presentity::edit_presentity_form_submitted));
217
  Ekiga::FormRequestSimple request(sigc::mem_fun (this, &RL::Presentity::edit_presentity_form_submitted));
218
218
219
   // FIXME: we should be able to know all groups in the heap
219
  // FIXME: we should be able to know all groups in the heap
220
  std::set<std::string> all_groups = groups;
220
  std::set<std::string> all_groups = groups;
221
221
222
  request.title (_("Edit remote contact"));
222
  request.title (_("Edit remote contact"));
Lines 246-306 RL::Presentity::edit_presentity_form_submitted (bool submitted, Link Here
246
  if (!submitted)
246
  if (!submitted)
247
    return;
247
    return;
248
248
249
  try {
249
  const std::string new_name = result.text ("name");
250
250
  const std::string new_uri = result.text ("uri");
251
    const std::string new_name = result.text ("name");
251
  const std::set<std::string> new_groups = result.editable_set ("groups");
252
    const std::string new_uri = result.text ("uri");
252
  std::map<std::string, xmlNodePtr> future_group_nodes;
253
    const std::set<std::string> new_groups = result.editable_set ("groups");
253
  xmlNsPtr ns = xmlSearchNsByHref (node->doc, node,
254
    std::map<std::string, xmlNodePtr> future_group_nodes;
254
				   BAD_CAST "http://www.ekiga.org");
255
    xmlNsPtr ns = xmlSearchNsByHref (node->doc, node,
255
  bool reload = false;
256
				     BAD_CAST "http://www.ekiga.org");
257
    bool reload = false;
258
256
259
    robust_xmlNodeSetContent (node, &name_node, "name", new_name);
257
  robust_xmlNodeSetContent (node, &name_node, "name", new_name);
260
258
261
    if (uri != new_uri) {
259
  if (uri != new_uri) {
262
260
263
      xmlSetProp (node, (const xmlChar*)"uri", (const xmlChar*)uri.c_str ());
261
    xmlSetProp (node, (const xmlChar*)"uri", (const xmlChar*)uri.c_str ());
264
      gmref_ptr<Ekiga::PresenceCore> presence_core(services.get ("presence-core"));
262
    gmref_ptr<Ekiga::PresenceCore> presence_core(services.get ("presence-core"));
265
      presence_core->unfetch_presence (uri);
263
    presence_core->unfetch_presence (uri);
266
      reload = true;
264
    reload = true;
267
    }
265
  }
268
266
269
    for (std::map<std::string, xmlNodePtr>::const_iterator iter
267
  for (std::map<std::string, xmlNodePtr>::const_iterator iter
270
	   = group_nodes.begin ();
268
	 = group_nodes.begin ();
271
	 iter != group_nodes.end () ;
269
       iter != group_nodes.end () ;
272
	 iter++) {
270
       iter++) {
273
271
274
      if (new_groups.find (iter->first) == new_groups.end ()) {
272
    if (new_groups.find (iter->first) == new_groups.end ()) {
275
273
276
	xmlUnlinkNode (iter->second);
274
      xmlUnlinkNode (iter->second);
277
	xmlFreeNode (iter->second);
275
      xmlFreeNode (iter->second);
278
      }
279
      else {
280
	future_group_nodes[iter->first] = iter->second;
281
      }
282
    }
276
    }
283
277
    else {
284
    for (std::set<std::string>::const_iterator iter = new_groups.begin ();
278
      future_group_nodes[iter->first] = iter->second;
285
	 iter != new_groups.end ();
286
	 iter++) {
287
288
      if (std::find (groups.begin (), groups.end (), *iter) == groups.end ())
289
	future_group_nodes[*iter] = xmlNewChild (node, ns,
290
						 BAD_CAST "group",
291
						 BAD_CAST robust_xmlEscape (node->doc, *iter).c_str ());
292
    }
279
    }
280
  }
293
281
294
    group_nodes = future_group_nodes;
282
  for (std::set<std::string>::const_iterator iter = new_groups.begin ();
295
    groups = new_groups;
283
       iter != new_groups.end ();
284
       iter++) {
296
285
297
    save (reload);
286
    if (std::find (groups.begin (), groups.end (), *iter) == groups.end ())
298
  } catch (Ekiga::Form::not_found) {
287
      future_group_nodes[*iter] = xmlNewChild (node, ns,
299
#ifdef __GNUC__
288
					       BAD_CAST "group",
300
    std::cerr << "Invalid form submitted to "
289
					       BAD_CAST robust_xmlEscape (node->doc, *iter).c_str ());
301
	      << __PRETTY_FUNCTION__ << std::endl;
302
#endif
303
  }
290
  }
291
292
  group_nodes = future_group_nodes;
293
  groups = new_groups;
294
295
  save (reload);
304
}
296
}
305
297
306
void
298
void
(-)a/lib/engine/framework/form-builder.cpp (-9 / +7 lines)
Lines 148-155 Ekiga::FormBuilder::hidden (const std::string name) const Link Here
148
       iter++)
148
       iter++)
149
    if (iter->name == name)
149
    if (iter->name == name)
150
      return iter->value;
150
      return iter->value;
151
152
  throw Ekiga::Form::not_found (name);
153
}
151
}
154
152
155
bool
153
bool
Lines 161-167 Ekiga::FormBuilder::boolean (const std::string name) const Link Here
161
    if (iter->name == name)
159
    if (iter->name == name)
162
      return iter->value;
160
      return iter->value;
163
161
164
  throw Ekiga::Form::not_found (name);
162
  return false; // shouldn't happen
165
}
163
}
166
164
167
const std::string
165
const std::string
Lines 173-179 Ekiga::FormBuilder::private_text (const std::string name) const Link Here
173
    if (iter->name == name)
171
    if (iter->name == name)
174
      return iter->value;
172
      return iter->value;
175
173
176
  throw Ekiga::Form::not_found (name);
174
  return ""; // shouldn't happen
177
}
175
}
178
176
179
const std::string
177
const std::string
Lines 185-191 Ekiga::FormBuilder::text (const std::string name) const Link Here
185
    if (iter->name == name)
183
    if (iter->name == name)
186
      return iter->value;
184
      return iter->value;
187
185
188
  throw Ekiga::Form::not_found (name);
186
  return ""; // shouldn't happen
189
}
187
}
190
188
191
const std::string
189
const std::string
Lines 197-203 Ekiga::FormBuilder::multi_text (const std::string name) const Link Here
197
    if (iter->name == name)
195
    if (iter->name == name)
198
      return iter->value;
196
      return iter->value;
199
197
200
  throw Ekiga::Form::not_found (name);
198
  return ""; // shouldn't happen
201
}
199
}
202
200
203
const std::string
201
const std::string
Lines 209-215 Ekiga::FormBuilder::single_choice (const std::string name) const Link Here
209
    if (iter->name == name)
207
    if (iter->name == name)
210
      return iter->value;
208
      return iter->value;
211
209
212
  throw Ekiga::Form::not_found (name);
210
  return ""; // shouldn't happen
213
}
211
}
214
212
215
const std::set<std::string>
213
const std::set<std::string>
Lines 221-227 Ekiga::FormBuilder::multiple_choice (const std::string name) const Link Here
221
    if (iter->name == name)
219
    if (iter->name == name)
222
      return iter->values;
220
      return iter->values;
223
221
224
  throw Ekiga::Form::not_found (name);
222
  return std::set<std::string>(); // shouldn't happen
225
}
223
}
226
224
227
const std::set<std::string>
225
const std::set<std::string>
Lines 233-239 Ekiga::FormBuilder::editable_set (const std::string name) const Link Here
233
    if (iter->name == name)
231
    if (iter->name == name)
234
      return iter->values;
232
      return iter->values;
235
233
236
  throw Ekiga::Form::not_found (name);
234
  return std::set<std::string>(); // shouldn't happen
237
}
235
}
238
236
239
void
237
void
(-)a/lib/engine/framework/form.cpp (-17 / +8 lines)
Lines 51-107 Ekiga::EmptyForm::visit (FormVisitor &/*visitor*/) const Link Here
51
}
51
}
52
52
53
const std::string
53
const std::string
54
Ekiga::EmptyForm::hidden (const std::string name) const
54
Ekiga::EmptyForm::hidden (const std::string /*name*/) const
55
{
55
{
56
  throw Form::not_found (name);
57
  return "";
56
  return "";
58
}
57
}
59
58
60
bool Ekiga::EmptyForm::boolean (const std::string name) const
59
bool Ekiga::EmptyForm::boolean (const std::string /*name*/) const
61
{
60
{
62
  throw Form::not_found (name);
63
  return false;
61
  return false;
64
}
62
}
65
63
66
const std::string
64
const std::string
67
Ekiga::EmptyForm::text (const std::string name) const
65
Ekiga::EmptyForm::text (const std::string /*name*/) const
68
{
66
{
69
  throw Form::not_found (name);
70
  return "";
67
  return "";
71
}
68
}
72
69
73
const std::string
70
const std::string
74
Ekiga::EmptyForm::private_text (const std::string name) const
71
Ekiga::EmptyForm::private_text (const std::string /*name*/) const
75
{
72
{
76
  throw Form::not_found (name);
77
  return "";
73
  return "";
78
}
74
}
79
75
80
81
const std::string
76
const std::string
82
Ekiga::EmptyForm::multi_text (const std::string name) const
77
Ekiga::EmptyForm::multi_text (const std::string /*name*/) const
83
{
78
{
84
  throw Form::not_found (name);
85
  return "";
79
  return "";
86
}
80
}
87
81
88
const std::string
82
const std::string
89
Ekiga::EmptyForm::single_choice (const std::string name) const
83
Ekiga::EmptyForm::single_choice (const std::string /*name*/) const
90
{
84
{
91
  throw Form::not_found (name);
92
  return "";
85
  return "";
93
}
86
}
94
87
95
const std::set<std::string>
88
const std::set<std::string>
96
Ekiga::EmptyForm::multiple_choice (const std::string name) const
89
Ekiga::EmptyForm::multiple_choice (const std::string /*name*/) const
97
{
90
{
98
  throw Form::not_found (name);
99
  return std::set<std::string>();
91
  return std::set<std::string>();
100
}
92
}
101
93
102
const std::set<std::string>
94
const std::set<std::string>
103
Ekiga::EmptyForm::editable_set (const std::string name) const
95
Ekiga::EmptyForm::editable_set (const std::string /*name*/) const
104
{
96
{
105
  throw Form::not_found (name);
106
  return std::set<std::string>();
97
  return std::set<std::string>();
107
}
98
}
(-)a/lib/engine/framework/form.h (-17 lines)
Lines 50-71 namespace Ekiga Link Here
50
  {
50
  {
51
  public:
51
  public:
52
52
53
    class not_found: public std::exception
54
    {
55
    public:
56
57
      not_found (const std::string _name): name(_name)
58
      {}
59
60
      ~not_found () throw ()
61
      {}
62
63
      const char* what() const throw() { return "form field not found"; }
64
65
      const std::string name;
66
67
    };
68
69
    virtual ~Form () {}
53
    virtual ~Form () {}
70
54
71
    virtual void visit (FormVisitor &visitor) const = 0;
55
    virtual void visit (FormVisitor &visitor) const = 0;
72
-

Return to bug 269329