X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcclient%2Fclient.c;h=c19f206ebe43d92ba80f6b68397c5acfb08e92d8;hb=10abd339ccd4ef4b5540d2bee269c8edba4fd9e7;hp=fd17296d46772b06367d5b1ad416904939e35c3f;hpb=7807059b5025de7806fd58cf9c3667b51fe6c1d2;p=silc.git diff --git a/lib/silcclient/client.c b/lib/silcclient/client.c index fd17296d..c19f206e 100644 --- a/lib/silcclient/client.c +++ b/lib/silcclient/client.c @@ -1605,6 +1605,7 @@ void silc_client_notify_by_server(SilcClient client, silc_client_notify_by_server_pending, p); goto out; } + silc_free(client_id); /* Get old Client ID */ tmp = silc_argument_get_arg_type(args, 1, &tmp_len); @@ -1775,6 +1776,45 @@ void silc_client_notify_by_server(SilcClient client, /* Notify application */ client->ops->notify(client, conn, type, tmp); break; + + case SILC_NOTIFY_TYPE_CHANNEL_CHANGE: + /* + * Router has enforced a new ID to a channel. Let's change the old + * ID to the one provided here. + */ + + /* Get the old ID */ + tmp = silc_argument_get_arg_type(args, 1, &tmp_len); + if (!tmp) + goto out; + channel_id = silc_id_payload_parse_id(tmp, tmp_len); + if (!channel_id) + goto out; + + /* Get the channel entry */ + if (!silc_idcache_find_by_id_one(conn->channel_cache, (void *)channel_id, + SILC_ID_CHANNEL, &id_cache)) + break; + + channel = (SilcChannelEntry)id_cache->context; + + /* Free the old ID */ + silc_free(channel_id); + silc_free(channel->id); + + /* Get the new ID */ + tmp = silc_argument_get_arg_type(args, 2, &tmp_len); + if (!tmp) + goto out; + channel->id = silc_id_payload_parse_id(tmp, tmp_len); + if (!channel->id) + goto out; + + id_cache->id = (void *)channel->id; + + /* Notify application */ + client->ops->notify(client, conn, type, channel, channel); + break; default: break;