changeset 1878:b85585d02cd9 0.10.0-rc4

Merge main with crew
author Mikael Berthe <mikael@lilotux.net>
date Mon, 05 Apr 2010 23:25:45 +0200
parents 9f3d7430ba78 (current diff) c30fa2baf387 (diff)
children eef4e18f8a39
files
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/caps.c	Mon Apr 05 23:13:53 2010 +0200
+++ b/mcabber/mcabber/caps.c	Mon Apr 05 23:25:45 2010 +0200
@@ -1,7 +1,7 @@
 /*
  * caps.c       -- Entity Capabilities Cache for mcabber
  *
- * Copyright (C) 2008 Frank Zschockelt <mcabber@freakysoft.de>
+ * Copyright (C) 2008-2010 Frank Zschockelt <mcabber@freakysoft.de>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -75,7 +75,7 @@
                        const char *type)
 {
   caps *c;
-  if (!hash)
+  if (!hash || !category || !type)
     return;
 
   c = g_hash_table_lookup(caps_cache, hash);
@@ -89,7 +89,7 @@
 void caps_add_feature(char *hash, const char *feature)
 {
   caps *c;
-  if (!hash)
+  if (!hash || !feature)
     return;
   c = g_hash_table_lookup(caps_cache, hash);
   if (c) {
@@ -101,7 +101,7 @@
 int caps_has_feature(char *hash, char *feature)
 {
   caps *c;
-  if (!hash)
+  if (!hash || !feature)
     return 0;
   c = g_hash_table_lookup(caps_cache, hash);
   if (c)
@@ -148,7 +148,8 @@
 
   g_hash_table_steal(caps_cache, "");
   sha1 = g_checksum_new(G_CHECKSUM_SHA1);
-  identity = g_strdup_printf("%s/%s//%s<", c->category, c->type, c->name);
+  identity = g_strdup_printf("%s/%s//%s<", c->category, c->type,
+                             c->name ? c->name : "");
   g_checksum_update(sha1, (guchar*)identity, -1);
   g_free(identity);