| 375 handle = js->user->node; |
375 handle = js->user->node; |
| 376 |
376 |
| 377 if(!jabber_nodeprep_validate(room)) { |
377 if(!jabber_nodeprep_validate(room)) { |
| 378 char *buf = g_strdup_printf(_("%s is not a valid room name"), room); |
378 char *buf = g_strdup_printf(_("%s is not a valid room name"), room); |
| 379 purple_notify_error(gc, _("Invalid Room Name"), _("Invalid Room Name"), |
379 purple_notify_error(gc, _("Invalid Room Name"), _("Invalid Room Name"), |
| 380 buf); |
380 buf, purple_request_cpar_from_connection(gc)); |
| 381 purple_serv_got_join_chat_failed(gc, data); |
381 purple_serv_got_join_chat_failed(gc, data); |
| 382 g_free(buf); |
382 g_free(buf); |
| 383 return; |
383 return; |
| 384 } else if(!jabber_domain_validate(server)) { |
384 } else if(!jabber_domain_validate(server)) { |
| 385 char *buf = g_strdup_printf(_("%s is not a valid server name"), server); |
385 char *buf = g_strdup_printf(_("%s is not a valid server name"), server); |
| 386 purple_notify_error(gc, _("Invalid Server Name"), |
386 purple_notify_error(gc, _("Invalid Server Name"), |
| 387 _("Invalid Server Name"), buf); |
387 _("Invalid Server Name"), buf, |
| |
388 purple_request_cpar_from_connection(gc)); |
| 388 purple_serv_got_join_chat_failed(gc, data); |
389 purple_serv_got_join_chat_failed(gc, data); |
| 389 g_free(buf); |
390 g_free(buf); |
| 390 return; |
391 return; |
| 391 } else if(!jabber_resourceprep_validate(handle)) { |
392 } else if(!jabber_resourceprep_validate(handle)) { |
| 392 char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle); |
393 char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle); |
| 393 purple_notify_error(gc, _("Invalid Room Handle"), |
394 purple_notify_error(gc, _("Invalid Room Handle"), |
| 394 _("Invalid Room Handle"), buf); |
395 _("Invalid Room Handle"), buf, |
| |
396 purple_request_cpar_from_connection(gc)); |
| 395 purple_serv_got_join_chat_failed(gc, data); |
397 purple_serv_got_join_chat_failed(gc, data); |
| 396 g_free(buf); |
398 g_free(buf); |
| 397 return; |
399 return; |
| 398 } |
400 } |
| 399 |
401 |
| 532 } |
534 } |
| 533 } |
535 } |
| 534 } else if (type == JABBER_IQ_ERROR) { |
536 } else if (type == JABBER_IQ_ERROR) { |
| 535 char *msg = jabber_parse_error(js, packet, NULL); |
537 char *msg = jabber_parse_error(js, packet, NULL); |
| 536 |
538 |
| 537 purple_notify_error(js->gc, _("Configuration error"), _("Configuration error"), msg); |
539 purple_notify_error(js->gc, _("Configuration error"), |
| |
540 _("Configuration error"), msg, |
| |
541 purple_request_cpar_from_connection(js->gc)); |
| 538 |
542 |
| 539 if(msg) |
543 if(msg) |
| 540 g_free(msg); |
544 g_free(msg); |
| 541 return; |
545 return; |
| 542 } |
546 } |
| 543 |
547 |
| 544 msg = g_strdup_printf("Unable to configure room %s", from); |
548 msg = g_strdup_printf("Unable to configure room %s", from); |
| 545 |
549 |
| 546 purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg); |
550 purple_notify_info(js->gc, _("Unable to configure"), |
| |
551 _("Unable to configure"), msg, |
| |
552 purple_request_cpar_from_connection(js->gc)); |
| 547 g_free(msg); |
553 g_free(msg); |
| 548 |
554 |
| 549 } |
555 } |
| 550 |
556 |
| 551 void jabber_chat_request_room_configure(JabberChat *chat) { |
557 void jabber_chat_request_room_configure(JabberChat *chat) { |
| 556 return; |
562 return; |
| 557 |
563 |
| 558 chat->config_dialog_handle = NULL; |
564 chat->config_dialog_handle = NULL; |
| 559 |
565 |
| 560 if(!chat->muc) { |
566 if(!chat->muc) { |
| 561 purple_notify_error(chat->js->gc, _("Room Configuration Error"), _("Room Configuration Error"), |
567 purple_notify_error(chat->js->gc, _("Room Configuration Error"), |
| 562 _("This room is not capable of being configured")); |
568 _("Room Configuration Error"), |
| |
569 _("This room is not capable of being configured"), |
| |
570 purple_request_cpar_from_connection(chat->js->gc)); |
| 563 return; |
571 return; |
| 564 } |
572 } |
| 565 |
573 |
| 566 iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, |
574 iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, |
| 567 "http://jabber.org/protocol/muc#owner"); |
575 "http://jabber.org/protocol/muc#owner"); |
| 607 PurpleXmlNode *packet, gpointer data) |
615 PurpleXmlNode *packet, gpointer data) |
| 608 { |
616 { |
| 609 if (type == JABBER_IQ_ERROR) { |
617 if (type == JABBER_IQ_ERROR) { |
| 610 char *msg = jabber_parse_error(js, packet, NULL); |
618 char *msg = jabber_parse_error(js, packet, NULL); |
| 611 |
619 |
| 612 purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg); |
620 purple_notify_error(js->gc, _("Registration error"), |
| |
621 _("Registration error"), msg, |
| |
622 purple_request_cpar_from_connection(js->gc)); |
| 613 |
623 |
| 614 if(msg) |
624 if(msg) |
| 615 g_free(msg); |
625 g_free(msg); |
| 616 return; |
626 return; |
| 617 } |
627 } |
| 676 } |
686 } |
| 677 } |
687 } |
| 678 } else if (type == JABBER_IQ_ERROR) { |
688 } else if (type == JABBER_IQ_ERROR) { |
| 679 char *msg = jabber_parse_error(js, packet, NULL); |
689 char *msg = jabber_parse_error(js, packet, NULL); |
| 680 |
690 |
| 681 purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg); |
691 purple_notify_error(js->gc, _("Registration error"), |
| |
692 _("Registration error"), msg, |
| |
693 purple_request_cpar_from_connection(js->gc)); |
| 682 |
694 |
| 683 if(msg) |
695 if(msg) |
| 684 g_free(msg); |
696 g_free(msg); |
| 685 return; |
697 return; |
| 686 } |
698 } |
| 687 |
699 |
| 688 msg = g_strdup_printf("Unable to configure room %s", from); |
700 msg = g_strdup_printf("Unable to configure room %s", from); |
| 689 |
701 |
| 690 purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg); |
702 purple_notify_info(js->gc, _("Unable to configure"), _("Unable to " |
| |
703 "configure"), msg, purple_request_cpar_from_connection(js->gc)); |
| 691 g_free(msg); |
704 g_free(msg); |
| 692 |
705 |
| 693 } |
706 } |
| 694 |
707 |
| 695 void jabber_chat_register(JabberChat *chat) |
708 void jabber_chat_register(JabberChat *chat) |
| 807 return; |
820 return; |
| 808 |
821 |
| 809 if (type == JABBER_IQ_ERROR) { |
822 if (type == JABBER_IQ_ERROR) { |
| 810 char *err = jabber_parse_error(js, packet, NULL); |
823 char *err = jabber_parse_error(js, packet, NULL); |
| 811 purple_notify_error(js->gc, _("Error"), |
824 purple_notify_error(js->gc, _("Error"), |
| 812 _("Error retrieving room list"), err); |
825 _("Error retrieving room list"), err, |
| |
826 purple_request_cpar_from_connection(js->gc)); |
| 813 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
827 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
| 814 g_object_unref(js->roomlist); |
828 g_object_unref(js->roomlist); |
| 815 js->roomlist = NULL; |
829 js->roomlist = NULL; |
| 816 g_free(err); |
830 g_free(err); |
| 817 return; |
831 return; |
| 818 } |
832 } |
| 819 |
833 |
| 820 if(!(query = purple_xmlnode_get_child(packet, "query"))) { |
834 if(!(query = purple_xmlnode_get_child(packet, "query"))) { |
| 821 char *err = jabber_parse_error(js, packet, NULL); |
835 char *err = jabber_parse_error(js, packet, NULL); |
| 822 purple_notify_error(js->gc, _("Error"), |
836 purple_notify_error(js->gc, _("Error"), |
| 823 _("Error retrieving room list"), err); |
837 _("Error retrieving room list"), err, |
| |
838 purple_request_cpar_from_connection(js->gc)); |
| 824 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
839 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
| 825 g_object_unref(js->roomlist); |
840 g_object_unref(js->roomlist); |
| 826 js->roomlist = NULL; |
841 js->roomlist = NULL; |
| 827 g_free(err); |
842 g_free(err); |
| 828 return; |
843 return; |
| 866 |
881 |
| 867 if(!js->roomlist) |
882 if(!js->roomlist) |
| 868 return; |
883 return; |
| 869 |
884 |
| 870 if(!server || !*server) { |
885 if(!server || !*server) { |
| 871 purple_notify_error(js->gc, _("Invalid Server"), _("Invalid Server"), NULL); |
886 purple_notify_error(js->gc, _("Invalid Server"), |
| |
887 _("Invalid Server"), NULL, |
| |
888 purple_request_cpar_from_connection(js->gc)); |
| 872 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
889 purple_roomlist_set_in_progress(js->roomlist, FALSE); |
| 873 return; |
890 return; |
| 874 } |
891 } |
| 875 |
892 |
| 876 purple_roomlist_set_in_progress(js->roomlist, TRUE); |
893 purple_roomlist_set_in_progress(js->roomlist, TRUE); |