# HG changeset patch # User Paul Aurich # Date 1227225497 0 # Node ID 1225f3dcf5ab329649992971457be4ab1b8ade90 # Parent 9ab681f2300742e3d48117680d3b9706ecf2c1c5 Fix compilation errors and many warnings diff -r 9ab681f23007 -r 1225f3dcf5ab libpurple/protocols/jabber/caps.c --- a/libpurple/protocols/jabber/caps.c Thu Nov 20 21:57:52 2008 +0000 +++ b/libpurple/protocols/jabber/caps.c Thu Nov 20 23:58:17 2008 +0000 @@ -25,9 +25,9 @@ #include "caps.h" #include "cipher.h" #include -#include "internal.h" +#include "iq.h" +#include "presence.h" #include "util.h" -#include "iq.h" #define JABBER_CAPS_FILENAME "xmpp-caps.xml" @@ -90,6 +90,7 @@ g_free(valuestruct); } +#if 0 static void jabber_caps_ext_destroy_value(gpointer value) { JabberCapsValueExt *valuestruct = value; while(valuestruct->identities) { @@ -107,13 +108,13 @@ } g_free(valuestruct); } +#endif static void jabber_caps_load(void); void jabber_caps_init(void) { capstable = g_hash_table_new_full(jabber_caps_hash, jabber_caps_compare, jabber_caps_destroy_key, jabber_caps_destroy_value); jabber_caps_load(); - jabber_caps_calculate_own_hash(); } static void jabber_caps_load(void) { @@ -236,6 +237,7 @@ g_free(str); } +#if 0 /* this function assumes that all information is available locally */ static JabberCapsClientInfo *jabber_caps_collect_info(const char *node, const char *ver, GList *ext) { JabberCapsClientInfo *result; @@ -298,6 +300,7 @@ #endif return result; } +#endif void jabber_caps_free_clientinfo(JabberCapsClientInfo *clientinfo) { if(!clientinfo) @@ -415,6 +418,7 @@ jabber_caps_get_info_check_completion(userdata); } #endif + static void jabber_caps_client_iqcb(JabberStream *js, xmlnode *packet, gpointer data) { /* collect data and fetch all exts */ xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", @@ -427,10 +431,14 @@ // check hash JabberCapsClientInfo *info = jabber_caps_parse_client_info(query); gchar *hash = 0; + JabberCapsValue *value; + JabberCapsKey *key; + xmlnode *child; + if (!strcmp(userdata->hash, "sha-1")) { - hash = jabber_caps_calcualte_hash(info, "sha1"); + hash = jabber_caps_calculate_hash(info, "sha1"); } else if (!strcmp(userdata->hash, "md5")) { - hash = jabber_caps_calcualte_hash(info, "md5"); + hash = jabber_caps_calculate_hash(info, "md5"); } else { // clean up return; @@ -451,10 +459,9 @@ g_free(hash); - JabberCapsValue *value = g_new0(JabberCapsValue, 1); - JabberCapsKey *key = g_new0(JabberCapsKey, 1); - xmlnode *child; - GList *iter; + value = g_new0(JabberCapsValue, 1); + key = g_new0(JabberCapsKey, 1); + #if 0 value->ext = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, jabber_caps_ext_destroy_value); #endif @@ -523,6 +530,7 @@ jabber_caps_get_info_check_completion(userdata); #endif + } } void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, const char *ver, const char *hash, jabber_caps_get_info_cb cb, gpointer user_data) { @@ -612,6 +620,7 @@ } } +#if 0 static gint jabber_caps_jabber_feature_compare(gconstpointer a, gconstpointer b) { const JabberFeature *ac; const JabberFeature *bc; @@ -621,6 +630,7 @@ return strcmp(ac->namespace, bc->namespace); } +#endif static gint jabber_caps_string_compare(gconstpointer a, gconstpointer b) { const gchar *ac; @@ -632,7 +642,7 @@ return strcmp(ac, bc); } -gchar *jabber_caps_get_formtype(const xmlnode *x) { +static gchar *jabber_caps_get_formtype(const xmlnode *x) { xmlnode *formtypefield; formtypefield = xmlnode_get_child(x, "field"); while (formtypefield && strcmp(xmlnode_get_attrib(formtypefield, "var"), "FORM_TYPE")) formtypefield = xmlnode_get_next_twin(formtypefield); @@ -658,11 +668,12 @@ JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query) { xmlnode *child; - + JabberCapsClientInfo *info; + if (!query) return 0; if (strcmp(query->xmlns,"http://jabber.org/protocol/disco#info")) return 0; - JabberCapsClientInfo *info = g_new0(JabberCapsClientInfo, 1); + info = g_new0(JabberCapsClientInfo, 1); for(child = query->child; child; child = child->next) { if (!strcmp(child->name,"identity")) { @@ -704,7 +715,7 @@ return strcmp(ac->var, bc->var); } -GList *jabber_caps_xdata_get_fields(const xmlnode *x) { +static GList *jabber_caps_xdata_get_fields(const xmlnode *x) { GList *fields = 0; xmlnode *field; xmlnode *value; @@ -726,14 +737,14 @@ return fields; } -gchar *jabber_caps_verification_append(gchar *verification_string, gchar *string) { +static gchar *jabber_caps_verification_append(gchar *verification_string, gchar *string) { gchar *verification; verification = g_strconcat(verification_string, string, "<", NULL); g_free(verification_string); return verification; } -gchar *jabber_caps_calcualte_hash(JabberCapsClientInfo *info, const char *hash) { +gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash) { GList *identities; GList *features; GList *xdata; @@ -843,7 +854,7 @@ info->forms = 0; if (caps_hash) g_free(caps_hash); - caps_hash = jabber_caps_calcualte_hash(info, "sha1"); + caps_hash = jabber_caps_calculate_hash(info, "sha1"); g_free(info); g_list_free(features); } diff -r 9ab681f23007 -r 1225f3dcf5ab libpurple/protocols/jabber/caps.h --- a/libpurple/protocols/jabber/caps.h Thu Nov 20 21:57:52 2008 +0000 +++ b/libpurple/protocols/jabber/caps.h Thu Nov 20 23:58:17 2008 +0000 @@ -79,21 +79,21 @@ * @return The base64 encoded SHA-1 hash; needs to be freed if not needed * any furthermore. */ -gchar *jabber_caps_calcualte_hash(JabberCapsClientInfo *info, const char *hash); +gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash); /** - * Calcualte SHA1 hash for own featureset. + * Calculate SHA1 hash for own featureset. */ -void jabber_caps_calculate_own_hash(); +void jabber_caps_calculate_own_hash(JabberStream *js); /** Get the current caps hash. * @ret hash **/ -const gchar* jabber_caps_get_own_hash(); +const gchar* jabber_caps_get_own_hash(void); /** * Broadcast a new calculated hash using a stanza. */ -void jabber_caps_broadcast_change(); +void jabber_caps_broadcast_change(void); #endif /* _PURPLE_JABBER_CAPS_H_ */ diff -r 9ab681f23007 -r 1225f3dcf5ab libpurple/protocols/jabber/disco.c --- a/libpurple/protocols/jabber/disco.c Thu Nov 20 21:57:52 2008 +0000 +++ b/libpurple/protocols/jabber/disco.c Thu Nov 20 23:58:17 2008 +0000 @@ -97,7 +97,7 @@ xmlnode *in_query; const char *node = NULL; - const char *node_uri = NULL; + char *node_uri = NULL; // create custom caps node URI node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(), NULL); @@ -120,7 +120,7 @@ if(!node || !strcmp(node, node_uri)) { - GList *identities; + GList *features, *identities; for(identities = jabber_identities; identities; identities = identities->next) { JabberIdentity *ident = (JabberIdentity*)identities->data; identity = xmlnode_new_child(query, "identity"); @@ -128,7 +128,6 @@ xmlnode_set_attrib(identity, "type", ident->type); if (ident->name != 0) xmlnode_set_attrib(identity, "name", ident->name); } - GList *features; for(features = jabber_features; features; features = features->next) { JabberFeature *feat = (JabberFeature*)features->data; if(feat->is_enabled == NULL || feat->is_enabled(js, feat->namespace) == TRUE) { diff -r 9ab681f23007 -r 1225f3dcf5ab libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Thu Nov 20 21:57:52 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.c Thu Nov 20 23:58:17 2008 +0000 @@ -2561,7 +2561,7 @@ if (!caps_info) return FALSE; capabilities = g_hash_table_lookup(capstable, caps_info); - if (g_list_find_custom(capabilities->features, feature, strcmp) == NULL) return FALSE ; + if (g_list_find_custom(capabilities->features, feature, (GCompareFunc)strcmp) == NULL) return FALSE ; return TRUE; } diff -r 9ab681f23007 -r 1225f3dcf5ab libpurple/protocols/jabber/jabber.h --- a/libpurple/protocols/jabber/jabber.h Thu Nov 20 21:57:52 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.h Thu Nov 20 23:58:17 2008 +0000 @@ -278,6 +278,7 @@ extern GHashTable *jabber_contact_info; /* char * -> JabberCapsKey */ +void jabber_stream_features_parse(JabberStream *js, xmlnode *packet); void jabber_process_packet(JabberStream *js, xmlnode **packet); void jabber_send(JabberStream *js, xmlnode *data); void jabber_send_raw(JabberStream *js, const char *data, int len); diff -r 9ab681f23007 -r 1225f3dcf5ab libpurple/protocols/jabber/libxmpp.c --- a/libpurple/protocols/jabber/libxmpp.c Thu Nov 20 21:57:52 2008 +0000 +++ b/libpurple/protocols/jabber/libxmpp.c Thu Nov 20 23:58:17 2008 +0000 @@ -283,7 +283,7 @@ jabber_add_feature(AVATARNAMESPACEMETA, jabber_pep_namespace_only_when_pep_enabled_cb); jabber_add_feature(AVATARNAMESPACEDATA, jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_add_feature(http://www.xmpp.org/extensions/xep-0224.html#ns", + jabber_add_feature("http://www.xmpp.org/extensions/xep-0224.html#ns", jabber_buzz_isenabled); jabber_add_feature(XEP_0231_NAMESPACE, jabber_custom_smileys_isenabled); diff -r 9ab681f23007 -r 1225f3dcf5ab libpurple/protocols/jabber/message.c --- a/libpurple/protocols/jabber/message.c Thu Nov 20 21:57:52 2008 +0000 +++ b/libpurple/protocols/jabber/message.c Thu Nov 20 23:58:17 2008 +0000 @@ -1240,8 +1240,7 @@ return js->allowBuzz; } -gboolean jabber_custom_smileys_isenabled(JabberStream *js, const gchar *shortname, - const gchar *namespace) +gboolean jabber_custom_smileys_isenabled(JabberStream *js, const gchar *namespace) { const PurpleConnection *gc = js->gc; PurpleAccount *account = purple_connection_get_account(gc); diff -r 9ab681f23007 -r 1225f3dcf5ab libpurple/protocols/jabber/message.h --- a/libpurple/protocols/jabber/message.h Thu Nov 20 21:57:52 2008 +0000 +++ b/libpurple/protocols/jabber/message.h Thu Nov 20 23:58:17 2008 +0000 @@ -80,7 +80,6 @@ gboolean jabber_buzz_isenabled(JabberStream *js, const gchar *namespace); -gboolean jabber_custom_smileys_isenabled(JabberStream *js, const gchar *shortname, - const gchar *namespace); +gboolean jabber_custom_smileys_isenabled(JabberStream *js, const const gchar *namespace); #endif /* _PURPLE_JABBER_MESSAGE_H_ */