public keys.
+Mon May 7 18:18:48 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed CMODE channel auth public key retrieval. Affected
+ file is lib/silcclient/command.c.
+
+ * Fixed CMODE command reply to return channel public keys
+ correctly. Affected files are lib/silcclient/command_reply.c
+ and client_channel.c.
+
Sun May 6 12:43:19 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
* Added current channel key cipher name and HMAC name to
SILC Client ****PARTLY DONE****
===========
- o Porting to new Toolkit API and new Client Library API (***TESTING NEEDED)
+ o Porting to new Toolkit API and new Client Library API (***DONE)
o Improve help files, especially /cmode, /cumode and /key.
SilcBool silc_client_channel_save_public_keys(SilcChannelEntry channel,
unsigned char *chpk_list,
- SilcUInt32 chpk_list_len)
+ SilcUInt32 chpk_list_len,
+ SilcBool remove_all)
{
SilcArgumentDecodedList a, b;
SilcDList chpks;
SilcBool found;
+ if (remove_all) {
+ /* Remove all channel public keys */
+ if (!channel->channel_pubkeys)
+ return FALSE;
+
+ silc_dlist_start(channel->channel_pubkeys);
+ while ((b = silc_dlist_get(channel->channel_pubkeys)))
+ silc_dlist_del(channel->channel_pubkeys, b);
+
+ silc_dlist_uninit(channel->channel_pubkeys);
+ channel->channel_pubkeys = NULL;
+
+ return TRUE;
+ }
+
+ /* Parse channel public key list and add or remove public keys */
chpks = silc_argument_list_parse_decoded(chpk_list, chpk_list_len,
SILC_ARGUMENT_PUBLIC_KEY);
if (!chpks)
SilcChannelEntry channel);
SilcBool silc_client_channel_save_public_keys(SilcChannelEntry channel,
unsigned char *chpk_list,
- SilcUInt32 chpk_list_len);
+ SilcUInt32 chpk_list_len,
+ SilcBool remove_all);
#endif /* CLIENT_CHANNEL_H */
SilcBuffer idp;
SilcUInt16 cmd_ident;
- if (!client || !conn | !client_id)
+ if (!client || !conn | !client_id) {
+ SILC_LOG_ERROR(("Missing arguments to "
+ "silc_client_get_clients_by_id_resolve call"));
return 0;
+ }
SILC_LOG_DEBUG(("Resolve client by ID (%s)",
silc_id_render(client_id, SILC_ID_CLIENT)));
SILC_LOG_DEBUG(("Resolve client by %s command",
silc_get_command_name(command)));
- if (!client || !conn)
+ if (!client || !conn) {
+ SILC_LOG_ERROR(("Missing arguments to silc_client_get_clients call"));
return 0;
- if (!nickname && !attributes)
+ }
+ if (!nickname && !attributes) {
+ SILC_LOG_ERROR(("Missing arguments to silc_client_get_clients call"));
return 0;
+ }
/* Parse server name from the nickname if set */
if (silc_parse_userfqdn(nickname, nick, sizeof(nick),
if (!(channel->mode & SILC_CHANNEL_MODE_ULIMIT))
channel->user_limit = 0;
- /* Save the new mode */
- channel->mode = mode;
-
/* Get the channel public key that was added or removed */
tmp = silc_argument_get_arg_type(args, 7, &tmp_len);
if (tmp)
- silc_client_channel_save_public_keys(channel, tmp, tmp_len);
+ silc_client_channel_save_public_keys(channel, tmp, tmp_len, FALSE);
+ else if (channel->mode & SILC_CHANNEL_MODE_CHANNEL_AUTH)
+ silc_client_channel_save_public_keys(channel, NULL, 0, TRUE);
+
+ /* Save the new mode */
+ channel->mode = mode;
silc_rwlock_unlock(channel->internal.lock);
silc_free(keys);
}
+/* Return private message key from the client entry. */
+
+SilcBool
+silc_client_private_message_key_is_set(SilcClient client,
+ SilcClientConnection conn,
+ SilcClientEntry client_entry)
+{
+ return client_entry->internal.send_key != NULL;
+}
+
/* Sets away `message'. The away message may be set when the client's
mode is changed to SILC_UMODE_GONE and the client whishes to reply
to anyone who sends private message. The `message' will be sent
NULL, NULL, 1,
1, silc_buffer_datalen(chidp));
silc_buffer_free(chidp);
+ silc_client_unref_channel(client, conn, channel);
/* Notify application */
COMMAND(SILC_STATUS_OK);
- goto out;
+
+ /** Wait for command reply */
+ silc_fsm_next(fsm, silc_client_command_reply_wait);
+ return SILC_FSM_CONTINUE;
}
if (cmd->argc >= 4) {
/* Get channel public key list */
tmp = silc_argument_get_arg_type(args, 16, &len);
if (tmp)
- silc_client_channel_save_public_keys(channel, tmp, len);
+ silc_client_channel_save_public_keys(channel, tmp, len, FALSE);
/* Set current channel */
conn->current_channel = channel;
SilcChannelEntry channel;
SilcUInt32 len;
SilcPublicKey public_key = NULL;
- SilcDList channel_pubkeys = NULL;
SilcID id;
/* Sanity checks */
ERROR_CALLBACK(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
goto out;
}
+ SILC_GET32_MSB(mode, tmp);
silc_rwlock_wrlock(channel->internal.lock);
- /* Save the mode */
- SILC_GET32_MSB(mode, tmp);
- channel->mode = mode;
-
/* Get user limit */
tmp = silc_argument_get_arg_type(args, 6, &len);
if (tmp && len == 4)
/* Get channel public key(s) */
tmp = silc_argument_get_arg_type(args, 5, &len);
if (tmp)
- silc_client_channel_save_public_keys(channel, tmp, len);
+ silc_client_channel_save_public_keys(channel, tmp, len, FALSE);
+ else if (channel->mode & SILC_CHANNEL_MODE_CHANNEL_AUTH)
+ silc_client_channel_save_public_keys(channel, NULL, 0, TRUE);
+
+ /* Save the mode */
+ channel->mode = mode;
silc_rwlock_unlock(channel->internal.lock);
/* Notify application */
silc_client_command_callback(cmd, channel, mode, public_key,
- channel_pubkeys, channel->user_limit);
-
- silc_argument_list_free(channel_pubkeys, SILC_ARGUMENT_PUBLIC_KEY);
+ channel->channel_pubkeys, channel->user_limit);
out:
if (public_key)
void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
SilcUInt32 key_count);
+/****f* silcclient/SilcClientAPI/silc_client_private_message_key_is_set
+ *
+ * SYNOPSIS
+ *
+ * SilcBool
+ * silc_client_private_message_key_is_set(SilcClient client,
+ * SilcClientConnection conn,
+ * SilcClientEntry client_entry);
+ *
+ * DESCRIPTION
+ *
+ * Returns TRUE if the private message key has been set for the client
+ * entry indicated by `client_entry'.
+ *
+ ***/
+SilcBool
+silc_client_private_message_key_is_set(SilcClient client,
+ SilcClientConnection conn,
+ SilcClientEntry client_entry);
+
/* Channel private key management */