libpurple/request.c

changeset 42128
118067ca0367
parent 42127
18acb99a0fa6
child 42158
4a65f0fbc3dc
equal deleted inserted replaced
42127:18acb99a0fa6 42128:118067ca0367
619 619
620 ops->request_wait_update(ui_handle, FALSE, fraction); 620 ops->request_wait_update(ui_handle, FALSE, fraction);
621 } 621 }
622 622
623 static void 623 static void
624 purple_request_fields_strip_html(PurpleRequestFields *fields) 624 purple_request_fields_strip_html(PurpleRequestPage *page)
625 { 625 {
626 GList *itg; 626 GList *itg;
627 627
628 for (itg = purple_request_fields_get_groups(fields); 628 for (itg = purple_request_page_get_groups(page);
629 itg != NULL; 629 itg != NULL;
630 itg = g_list_next(itg)) 630 itg = g_list_next(itg))
631 { 631 {
632 PurpleRequestGroup *group = itg->data; 632 PurpleRequestGroup *group = itg->data;
633 GList *itf; 633 GList *itf;
650 } 650 }
651 } 651 }
652 652
653 void * 653 void *
654 purple_request_fields(void *handle, const char *title, const char *primary, 654 purple_request_fields(void *handle, const char *title, const char *primary,
655 const char *secondary, PurpleRequestFields *fields, const char *ok_text, 655 const char *secondary, PurpleRequestPage *page, const char *ok_text,
656 GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, 656 GCallback ok_cb, const char *cancel_text, GCallback cancel_cb,
657 PurpleRequestCommonParameters *cpar, void *user_data) 657 PurpleRequestCommonParameters *cpar, void *user_data)
658 { 658 {
659 PurpleRequestUiOps *ops; 659 PurpleRequestUiOps *ops;
660 660
661 if (G_UNLIKELY(fields == NULL || 661 if(G_UNLIKELY(!PURPLE_IS_REQUEST_PAGE(page) ||
662 ((ok_text == NULL) != (ok_cb == NULL)) || 662 ((ok_text == NULL) != (ok_cb == NULL)) ||
663 cancel_text == NULL)) 663 cancel_text == NULL))
664 { 664 {
665 purple_request_cpar_unref(cpar); 665 purple_request_cpar_unref(cpar);
666 g_warn_if_fail(fields != NULL); 666 g_warn_if_fail(PURPLE_IS_REQUEST_PAGE(page));
667 g_warn_if_fail((ok_text == NULL) != (ok_cb == NULL)); 667 g_warn_if_fail((ok_text == NULL) != (ok_cb == NULL));
668 g_warn_if_fail(cancel_text != NULL); 668 g_warn_if_fail(cancel_text != NULL);
669 g_return_val_if_reached(NULL); 669 g_return_val_if_reached(NULL);
670 } 670 }
671 671
672 ops = purple_request_get_ui_ops(); 672 ops = purple_request_get_ui_ops();
673 673
674 if (purple_request_cpar_is_html(cpar) && 674 if (purple_request_cpar_is_html(cpar) &&
675 !((ops->features & PURPLE_REQUEST_FEATURE_HTML))) 675 !((ops->features & PURPLE_REQUEST_FEATURE_HTML)))
676 { 676 {
677 purple_request_fields_strip_html(fields); 677 purple_request_fields_strip_html(page);
678 } 678 }
679 679
680 if (ops != NULL && ops->request_fields != NULL) { 680 if (ops != NULL && ops->request_fields != NULL) {
681 PurpleRequestInfo *info; 681 PurpleRequestInfo *info;
682 gchar **tmp; 682 gchar **tmp;
685 685
686 info = g_new0(PurpleRequestInfo, 1); 686 info = g_new0(PurpleRequestInfo, 1);
687 info->type = PURPLE_REQUEST_FIELDS; 687 info->type = PURPLE_REQUEST_FIELDS;
688 info->handle = handle; 688 info->handle = handle;
689 info->ui_handle = ops->request_fields(title, primary, secondary, 689 info->ui_handle = ops->request_fields(title, primary, secondary,
690 fields, ok_text, ok_cb, cancel_text, cancel_cb, 690 page, ok_text, ok_cb,
691 cpar, user_data); 691 cancel_text, cancel_cb, cpar,
692 user_data);
692 693
693 handles = g_list_append(handles, info); 694 handles = g_list_append(handles, info);
694 695
695 g_strfreev(tmp); 696 g_strfreev(tmp);
696 purple_request_cpar_unref(cpar); 697 purple_request_cpar_unref(cpar);

mercurial