Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/caps.c @ 25760:f462fa160f06
Sprinkle around more support for xml:lang on JabberIdentities
Change the IPC has_feature function to take a PurpleAccount and look up
the caps via the jbr
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 22 Nov 2008 18:26:45 +0000 |
parents | 7dcba13d0e28 |
children | 1b64942c5fb2 |
comparison
equal
deleted
inserted
replaced
25759:0e8b5b5c497a | 25760:f462fa160f06 |
---|---|
819 | 819 |
820 return purple_base64_encode(checksum, checksum_size); | 820 return purple_base64_encode(checksum, checksum_size); |
821 } | 821 } |
822 | 822 |
823 void jabber_caps_calculate_own_hash(JabberStream *js) { | 823 void jabber_caps_calculate_own_hash(JabberStream *js) { |
824 JabberCapsClientInfo *info; | 824 JabberCapsClientInfo info; |
825 GList *iter = 0; | 825 GList *iter = 0; |
826 GList *features = 0; | 826 GList *features = 0; |
827 | 827 |
828 if (jabber_identities == 0 && jabber_features == 0) return; | 828 if (!jabber_identities && !jabber_features) { |
829 | 829 /* This really shouldn't ever happen */ |
830 /* sort features */ | 830 purple_debug_warning("jabber", "No features or identities, cannot calculate own caps hash.\n"); |
831 g_free(js->caps_hash); | |
832 js->caps_hash = NULL; | |
833 return; | |
834 } | |
835 | |
836 /* build the currently-supported list of features */ | |
831 if (jabber_features) { | 837 if (jabber_features) { |
832 for (iter = jabber_features; iter; iter = iter->next) { | 838 for (iter = jabber_features; iter; iter = iter->next) { |
833 JabberFeature *feat = iter->data; | 839 JabberFeature *feat = iter->data; |
834 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->namespace) == TRUE) { | 840 if(!feat->is_enabled || feat->is_enabled(js, feat->namespace)) { |
835 features = g_list_append(features, feat->namespace); | 841 features = g_list_append(features, feat->namespace); |
836 } | 842 } |
837 } | 843 } |
838 } | 844 } |
839 | 845 |
840 info = g_new0(JabberCapsClientInfo, 1); | 846 info.features = features; |
841 info->features = features; | 847 info.identities = jabber_identities; |
842 info->identities = jabber_identities; | 848 info.forms = NULL; |
843 info->forms = 0; | 849 |
844 | 850 g_free(js->caps_hash); |
845 if (js->caps_hash) | 851 js->caps_hash = jabber_caps_calculate_hash(&info, "sha1"); |
846 g_free(js->caps_hash); | |
847 js->caps_hash = jabber_caps_calculate_hash(info, "sha1"); | |
848 g_free(info); | |
849 g_list_free(features); | 852 g_list_free(features); |
850 } | 853 } |
851 | 854 |
852 const gchar* jabber_caps_get_own_hash(JabberStream *js) | 855 const gchar* jabber_caps_get_own_hash(JabberStream *js) |
853 { | 856 { |