X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcclient%2Fidlist.c;h=f20efc260bbb325f945cc4fb8bdd8706e00ac4ed;hb=d56ab2d482dd7f21ceb3b18a1f4fe833bc0a9c3f;hp=75bbc521046c7f51775af32021f6ec1065b9c17b;hpb=666eb6a771f78fc48263d8551be4bf7e1848d709;p=silc.git diff --git a/lib/silcclient/idlist.c b/lib/silcclient/idlist.c index 75bbc521..f20efc26 100644 --- a/lib/silcclient/idlist.c +++ b/lib/silcclient/idlist.c @@ -976,6 +976,8 @@ SilcServerEntry silc_client_add_server(SilcClient client, { SilcServerEntry server_entry; + SILC_LOG_DEBUG(("Start")); + server_entry = silc_calloc(1, sizeof(*server_entry)); if (!server_entry || !server_id) return NULL; @@ -1012,6 +1014,34 @@ bool silc_client_del_server(SilcClient client, SilcClientConnection conn, return ret; } +/* Updates the `server_entry' with the new information sent as argument. */ + +void silc_client_update_server(SilcClient client, + SilcClientConnection conn, + SilcServerEntry server_entry, + const char *server_name, + const char *server_info) +{ + SILC_LOG_DEBUG(("Start")); + + if (server_name && (!server_entry->server_name || + strcmp(server_entry->server_name, server_name))) { + + silc_idcache_del_by_context(conn->server_cache, server_entry); + silc_free(server_entry->server_name); + server_entry->server_name = strdup(server_name); + silc_idcache_add(conn->server_cache, server_entry->server_name, + server_entry->server_id, + server_entry, 0, NULL); + } + + if (server_info && (!server_entry->server_info || + strcmp(server_entry->server_info, server_info))) { + silc_free(server_entry->server_info); + server_entry->server_info = strdup(server_info); + } +} + /* Formats the nickname of the client specified by the `client_entry'. If the format is specified by the application this will format the nickname and replace the old nickname in the client entry. If the