comparison src/protocols/jabber/chat.c @ 10045:ac98ece02b1f

[gaim-migrate @ 11005] also good for the gander committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 19 Sep 2004 04:17:23 +0000
parents a9fb4493ae22
children 4e376556566e
comparison
equal deleted inserted replaced
10044:86a6d78b070b 10045:ac98ece02b1f
708 gaim_roomlist_set_in_progress(js->roomlist, FALSE); 708 gaim_roomlist_set_in_progress(js->roomlist, FALSE);
709 gaim_roomlist_unref(js->roomlist); 709 gaim_roomlist_unref(js->roomlist);
710 js->roomlist = NULL; 710 js->roomlist = NULL;
711 } 711 }
712 712
713 static void roomlist_cancel_cb(JabberStream *js, const char *server) {
714 if(js->roomlist) {
715 gaim_roomlist_set_in_progress(js->roomlist, FALSE);
716 gaim_roomlist_unref(js->roomlist);
717 js->roomlist = NULL;
718 }
719 }
720
713 static void roomlist_ok_cb(JabberStream *js, const char *server) 721 static void roomlist_ok_cb(JabberStream *js, const char *server)
714 { 722 {
715 JabberIq *iq; 723 JabberIq *iq;
724
725 if(!js->roomlist)
726 return;
727
728 if(!server || !*server) {
729 gaim_notify_error(js->gc, _("Invalid Server"), _("Invalid Server"), NULL);
730 return;
731 }
732
733 gaim_roomlist_set_in_progress(js->roomlist, TRUE);
734
735 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
736
737 xmlnode_set_attrib(iq->node, "to", server);
738
739 jabber_iq_set_callback(iq, roomlist_disco_result_cb, NULL);
740
741 jabber_iq_send(iq);
742 }
743
744 GaimRoomlist *jabber_roomlist_get_list(GaimConnection *gc)
745 {
746 JabberStream *js = gc->proto_data;
716 GList *fields = NULL; 747 GList *fields = NULL;
717 GaimRoomlistField *f; 748 GaimRoomlistField *f;
718 749
719 if(!server || !*server) {
720 gaim_notify_error(js->gc, _("Invalid Server"), _("Invalid Server"), NULL);
721 return;
722 }
723
724 if(js->roomlist) 750 if(js->roomlist)
725 gaim_roomlist_unref(js->roomlist); 751 gaim_roomlist_unref(js->roomlist);
726 752
727 js->roomlist = gaim_roomlist_new(gaim_connection_get_account(js->gc)); 753 js->roomlist = gaim_roomlist_new(gaim_connection_get_account(js->gc));
728 754
735 f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Description"), "description", FALSE); 761 f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Description"), "description", FALSE);
736 fields = g_list_append(fields, f); 762 fields = g_list_append(fields, f);
737 763
738 gaim_roomlist_set_fields(js->roomlist, fields); 764 gaim_roomlist_set_fields(js->roomlist, fields);
739 765
740 gaim_roomlist_set_in_progress(js->roomlist, TRUE);
741
742 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
743
744 xmlnode_set_attrib(iq->node, "to", server);
745
746 jabber_iq_set_callback(iq, roomlist_disco_result_cb, NULL);
747
748 jabber_iq_send(iq);
749 }
750
751 GaimRoomlist *jabber_roomlist_get_list(GaimConnection *gc)
752 {
753 JabberStream *js = gc->proto_data;
754 766
755 gaim_request_input(gc, _("Enter a Conference Server"), _("Enter a Conference Server"), 767 gaim_request_input(gc, _("Enter a Conference Server"), _("Enter a Conference Server"),
756 _("Select a conference server to query"), 768 _("Select a conference server to query"),
757 js->chat_servers ? js->chat_servers->data : "conference.jabber.org", 769 js->chat_servers ? js->chat_servers->data : "conference.jabber.org",
758 FALSE, FALSE, NULL, 770 FALSE, FALSE, NULL,
759 _("Find Rooms"), G_CALLBACK(roomlist_ok_cb), _("Cancel"), NULL, js); 771 _("Find Rooms"), GAIM_CALLBACK(roomlist_ok_cb),
772 _("Cancel"), GAIM_CALLBACK(roomlist_cancel_cb), js);
760 773
761 return js->roomlist; 774 return js->roomlist;
762 } 775 }
763 776
764 void jabber_roomlist_cancel(GaimRoomlist *list) 777 void jabber_roomlist_cancel(GaimRoomlist *list)