Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/disco.c @ 26683:31c240da2cd3
More minor cleanup (no functional changes other than not printing a log msg)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 13 Apr 2009 16:35:13 +0000 |
parents | f1dd84b4964e |
children | 3371c36d77e8 |
comparison
equal
deleted
inserted
replaced
26682:15d681a53b5a | 26683:31c240da2cd3 |
---|---|
750 JabberIqType type, const char *id, | 750 JabberIqType type, const char *id, |
751 xmlnode *packet, gpointer data) | 751 xmlnode *packet, gpointer data) |
752 { | 752 { |
753 struct _disco_data *disco_data; | 753 struct _disco_data *disco_data; |
754 struct jabber_disco_list_data *list_data; | 754 struct jabber_disco_list_data *list_data; |
755 xmlnode *query, *identity, *child; | |
756 const char *anode; | |
757 char *aname, *node; | |
758 | |
755 PurpleDiscoList *list; | 759 PurpleDiscoList *list; |
756 PurpleDiscoService *parent; | 760 PurpleDiscoService *parent, *service; |
757 char *node; | |
758 xmlnode *query, *identity, *child; | |
759 const char *acat, *atype, *adesc, *anode; | |
760 char *aname; | |
761 PurpleDiscoService *s; | |
762 PurpleDiscoServiceType service_type; | 761 PurpleDiscoServiceType service_type; |
763 const char *gateway_type = NULL; | |
764 PurpleDiscoServiceFlags flags; | 762 PurpleDiscoServiceFlags flags; |
765 | 763 |
766 disco_data = data; | 764 disco_data = data; |
767 list_data = disco_data->list_data; | 765 list_data = disco_data->list_data; |
768 list = list_data->list; | 766 list = list_data->list; |
789 | 787 |
790 purple_disco_list_unref(list); | 788 purple_disco_list_unref(list); |
791 return; | 789 return; |
792 } | 790 } |
793 | 791 |
794 acat = xmlnode_get_attrib(identity, "category"); | 792 service_type = jabber_disco_category_from_string( |
795 atype = xmlnode_get_attrib(identity, "type"); | 793 xmlnode_get_attrib(identity, "category")); |
796 adesc = xmlnode_get_attrib(identity, "name"); | |
797 anode = xmlnode_get_attrib(query, "node"); | |
798 | |
799 if (anode) | |
800 aname = g_strdup_printf("%s%s", from, anode); | |
801 else | |
802 aname = g_strdup(from); | |
803 | |
804 service_type = jabber_disco_category_from_string(acat); | |
805 if (service_type == PURPLE_DISCO_SERVICE_TYPE_GATEWAY) | |
806 gateway_type = jabber_disco_type_from_string(atype); | |
807 | 794 |
808 /* Default to allowing things to be add-able */ | 795 /* Default to allowing things to be add-able */ |
809 flags = PURPLE_DISCO_ADD; | 796 flags = PURPLE_DISCO_ADD; |
810 | 797 |
811 for (child = xmlnode_get_child(query, "feature"); child; | 798 for (child = xmlnode_get_child(query, "feature"); child; |
823 | 810 |
824 if (g_str_equal(var, "http://jabber.org/protocol/muc")) | 811 if (g_str_equal(var, "http://jabber.org/protocol/muc")) |
825 service_type = PURPLE_DISCO_SERVICE_TYPE_CHAT; | 812 service_type = PURPLE_DISCO_SERVICE_TYPE_CHAT; |
826 } | 813 } |
827 | 814 |
828 purple_debug_info("disco", "service %s, category %s (%d), type %s (%s), description %s, flags %04x\n", | 815 if ((anode = xmlnode_get_attrib(query, "node"))) |
829 aname, | 816 aname = g_strdup_printf("%s%s", from, anode); |
830 acat, service_type, | 817 else |
831 atype, gateway_type ? gateway_type : "(null)", | 818 aname = g_strdup(from); |
832 adesc, flags); | 819 |
833 | 820 service = purple_disco_list_service_new(service_type, aname, |
834 s = purple_disco_list_service_new(service_type, aname, adesc, flags); | 821 xmlnode_get_attrib(identity, "name"), flags); |
822 g_free(aname); | |
823 | |
835 if (service_type == PURPLE_DISCO_SERVICE_TYPE_GATEWAY) | 824 if (service_type == PURPLE_DISCO_SERVICE_TYPE_GATEWAY) |
836 purple_disco_service_set_gateway_type(s, gateway_type); | 825 purple_disco_service_set_gateway_type(service, |
837 | 826 jabber_disco_type_from_string(xmlnode_get_attrib(identity, |
838 purple_disco_list_service_add(list, s, parent); | 827 "type"))); |
828 | |
829 purple_disco_list_service_add(list, service, parent); | |
839 | 830 |
840 /* if (flags & PURPLE_DISCO_FLAG_BROWSE) - not all browsable services has this future */ | 831 /* if (flags & PURPLE_DISCO_FLAG_BROWSE) - not all browsable services has this future */ |
841 { | 832 { |
842 ++list_data->fetch_count; | 833 ++list_data->fetch_count; |
843 purple_disco_list_ref(list); | 834 purple_disco_list_ref(list); |
844 disco_data = g_new0(struct _disco_data, 1); | 835 disco_data = g_new0(struct _disco_data, 1); |
845 disco_data->list_data = list_data; | 836 disco_data->list_data = list_data; |
846 disco_data->parent = s; | 837 disco_data->parent = service; |
847 | 838 |
848 jabber_disco_items_do(js, from, node, jabber_disco_service_items_cb, | 839 jabber_disco_items_do(js, from, node, jabber_disco_service_items_cb, |
849 disco_data); | 840 disco_data); |
850 } | 841 } |
851 | 842 |