From: Pekka Riikonen Date: Wed, 29 Nov 2006 19:54:09 +0000 (+0000) Subject: Added silc_idcache_update_by_context. X-Git-Tag: silc.client.1.1.beta1~159 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=510fa1da68f18f2c0e2518a690d254339a02a3bb Added silc_idcache_update_by_context. --- diff --git a/lib/silcapputil/silcidcache.c b/lib/silcapputil/silcidcache.c index 93364caf..5e662947 100644 --- a/lib/silcapputil/silcidcache.c +++ b/lib/silcapputil/silcidcache.c @@ -256,6 +256,22 @@ SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, return TRUE; } +/* Update entry by context */ + +SilcBool silc_idcache_update_by_context(SilcIDCache cache, void *context, + void *old_id, void *new_id, + char *old_name, char *new_name, + SilcBool free_old_name) +{ + SilcIDCacheEntry c; + + if (!silc_hash_table_find(cache->context_table, context, NULL, (void **)&c)) + return FALSE; + + return silc_idcache_update(cache, c, old_id, new_id, old_name, new_name, + free_old_name); +} + /* Returns all cache entrys from the ID cache to the `ret' ID Cache List. */ SilcBool silc_idcache_get_all(SilcIDCache cache, SilcList *ret_list) diff --git a/lib/silcapputil/silcidcache.h b/lib/silcapputil/silcidcache.h index aed03d85..6fcaa573 100644 --- a/lib/silcapputil/silcidcache.h +++ b/lib/silcapputil/silcidcache.h @@ -200,7 +200,7 @@ SilcBool silc_idcache_del_by_id(SilcIDCache cache, void *id, SilcBool silc_idcache_del_by_context(SilcIDCache cache, void *context, void *app_context); -/****f* silcapputil/SilcIDCacheAPI/silc_idcache_update_id +/****f* silcapputil/SilcIDCacheAPI/silc_idcache_update * * SYNOPSIS * @@ -225,6 +225,27 @@ SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, char *old_name, char *new_name, SilcBool free_old_name); +/****f* silcapputil/SilcIDCacheAPI/silc_idcache_update + * + * SYNOPSIS + * + * SilcBool + * silc_idcache_update_by_context(SilcIDCache cache, void *context, + * void *old_id, void *new_id, + * char *old_name, char *new_name, + * SilcBool free_old_name); + * + * DESCRIPTION + * + * Same as silc_idcache_update but finds the corrent ID cache entry by + * the `context' added to the ID cache. + * + ***/ +SilcBool silc_idcache_update_by_context(SilcIDCache cache, void *context, + void *old_id, void *new_id, + char *old_name, char *new_name, + SilcBool free_old_name); + /****f* silcapputil/SilcIDCacheAPI/silc_idcache_get_all * * SYNOPSIS