cpw.darkrain42.xmpp.bosh: 2ebe3cea: Whitespace, formatting, and // -> /* */
paul at darkrain42.org
paul at darkrain42.org
Sat Jan 17 23:51:40 EST 2009
-----------------------------------------------------------------
Revision: 2ebe3ceabe670de5e509d574e52f78e813bf3de7
Ancestor: 7dcd41b48fa94066496dfa0e1bc9c6257a511d64
Author: paul at darkrain42.org
Date: 2008-11-21T17:52:56
Branch: im.pidgin.cpw.darkrain42.xmpp.bosh
URL: http://d.pidgin.im/viewmtn/revision/info/2ebe3ceabe670de5e509d574e52f78e813bf3de7
Modified files:
libpurple/protocols/jabber/caps.c
ChangeLog:
Whitespace, formatting, and // -> /* */
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/caps.c 318eaf1ba97cd03822ce4f80fe23346cd86e67aa
+++ libpurple/protocols/jabber/caps.c a072ffa55353ef0e98d83b69ee05ec763bc5ee5c
@@ -87,7 +87,7 @@ static void jabber_caps_destroy_value(gp
g_free(valuestruct->forms->data);
valuestruct->forms = g_list_delete_link(valuestruct->forms,valuestruct->forms);
}
- //g_hash_table_destroy(valuestruct->ext);
+ /* g_hash_table_destroy(valuestruct->ext); */
g_free(valuestruct);
}
@@ -431,7 +431,7 @@ static void jabber_caps_client_iqcb(Jabb
/* TODO: Better error checking! */
if (!strcmp(xmlnode_get_attrib(packet, "type"), "error"))return;
if (query) {
- // check hash
+ /* check hash */
JabberCapsClientInfo *info = jabber_caps_parse_client_info(query);
gchar *hash = 0;
JabberCapsValue *value;
@@ -443,7 +443,7 @@ static void jabber_caps_client_iqcb(Jabb
} else if (!strcmp(userdata->hash, "md5")) {
hash = jabber_caps_calculate_hash(info, "md5");
} else {
- // clean up
+ /* TODO: clean up */
return;
}
@@ -666,8 +666,8 @@ JabberCapsClientInfo *jabber_caps_parse_
xmlnode *child;
JabberCapsClientInfo *info;
- if (!query) return 0;
- if (strcmp(query->xmlns,"http://jabber.org/protocol/disco#info")) return 0;
+ if (!query || strcmp(query->xmlns, "http://jabber.org/protocol/disco#info"))
+ return 0;
info = g_new0(JabberCapsClientInfo, 1);
@@ -740,7 +740,8 @@ static gchar *jabber_caps_verification_a
return verification;
}
-gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash) {
+gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash)
+{
GList *identities;
GList *features;
GList *xdata;
@@ -751,32 +752,35 @@ gchar *jabber_caps_calculate_hash(Jabber
PurpleCipherContext *context;
guint8 checksum[20];
gsize checksum_size = 20;
-
- if (!info) return 0;
-
+
+ if (!info)
+ return 0;
+
/* sort identities, features and x-data forms */
info->identities = g_list_sort(info->identities, jabber_caps_jabber_identity_compare);
info->features = g_list_sort(info->features, (GCompareFunc)strcmp);
info->forms = g_list_sort(info->forms, jabber_caps_jabber_xdata_compare);
-
+
/* concat identities to the verification string */
for(identities = info->identities; identities; identities = identities->next) {
JabberIdentity *ident = (JabberIdentity*)identities->data;
identity_string = g_strdup_printf("%s/%s//%s<", ident->category, ident->type, ident->name);
free_verification = verification;
- if(verification == 0) verification = g_strdup(identity_string);
- else verification = g_strconcat(verification, identity_string, NULL);
+ if(verification == 0)
+ verification = g_strdup(identity_string);
+ else
+ verification = g_strconcat(verification, identity_string, NULL);
g_free(identity_string);
g_free(free_verification);
}
-
+
/* concat features to the verification string */
for(features = info->features; features; features = features->next) {
feature_string = g_strdup_printf("%s", (gchar*)features->data);
verification = jabber_caps_verification_append(verification, feature_string);
g_free(feature_string);
}
-
+
/* concat x-data forms to the verification string */
for(xdata = info->forms; xdata; xdata = xdata->next) {
gchar *formtype = 0;
@@ -805,25 +809,25 @@ gchar *jabber_caps_calculate_hash(Jabber
}
g_list_free(fields);
}
-
+
/* generate hash */
context = purple_cipher_context_new_by_name(hash, NULL);
if (context == NULL) {
- //purple_debug_error("jabber", "Could not find cipher\n");
+ /* purple_debug_error("jabber", "Could not find cipher\n"); */
return 0;
}
purple_cipher_context_append(context, (guchar*)verification, strlen(verification));
-
+
if (!purple_cipher_context_digest(context, strlen(verification), checksum, &checksum_size)) {
- //purple_debug_error("util", "Failed to get digest.\n");
+ /* purple_debug_error("util", "Failed to get digest.\n"); */
}
purple_cipher_context_destroy(context);
-
+
/* apply Base64 on hash */
-
+
g_free(verification);
verification = purple_base64_encode(checksum, checksum_size);
-
+
return verification;
}
More information about the Commits
mailing list