{ STAT(NO_SERVER_ID), "No Server ID given" },
{ STAT(BAD_CLIENT_ID), "Bad Client ID" },
{ STAT(BAD_CHANNEL_ID), "Bad Channel ID" },
- { STAT(NO_SUCH_CLIENT_ID), "No such Client ID" },
- { STAT(NO_SUCH_CHANNEL_ID),"No such Channel ID" },
+ { STAT(NO_SUCH_CLIENT_ID), "There was no such client" },
+ { STAT(NO_SUCH_CHANNEL_ID),"There was no such channel" },
{ STAT(NICKNAME_IN_USE), "Nickname already exists" },
{ STAT(NOT_ON_CHANNEL), "You are not on that channel" },
{ STAT(USER_NOT_ON_CHANNEL),"They are not on the channel" },
void silc_client_command_reply_free(SilcClientCommandReplyContext cmd)
{
if (cmd) {
- silc_command_free_payload(cmd->payload);
+ silc_command_payload_free(cmd->payload);
silc_free(cmd);
}
}
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn, "Cannot set nickname: %s",
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+ "Cannot set nickname: %s",
silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
argc = silc_argument_get_arg_num(cmd->args);
if (argc < 2 || argc > 2) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot set nickname: bad reply to command");
COMMAND_REPLY_ERROR;
goto out;
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
SILC_CLIENT_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_TOPIC);
channel = (SilcChannelEntry)id_cache->context;
- cmd->client->ops->say(cmd->client, conn,
- "Topic on channel %s: %s", channel->channel_name,
- topic);
-
/* Notify application */
COMMAND_REPLY((ARGS, channel, topic));
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
SILC_CLIENT_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_INVITE);
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
SILC_CLIENT_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_INFO);
if (!tmp)
goto out;
- client->ops->say(cmd->client, conn, "Info: %s", tmp);
+ client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
+ "Info: %s", tmp);
/* Notify application */
COMMAND_REPLY((ARGS, NULL, (char *)tmp));
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
for (i = 0; i < conn->ping_count; i++) {
if (SILC_ID_SERVER_COMPARE(conn->ping[i].dest_id, id)) {
diff = curtime - conn->ping[i].start_time;
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
"Ping reply from %s: %d second%s",
conn->ping[i].dest_name, diff,
diff == 1 ? "" : "s");
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
argc = silc_argument_get_arg_num(cmd->args);
if (argc < 7 || argc > 14) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot join channel: Bad reply packet");
COMMAND_REPLY_ERROR;
goto out;
/* Get channel name */
tmp = silc_argument_get_arg_type(cmd->args, 2, NULL);
if (!tmp) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot join channel: Bad reply packet");
COMMAND_REPLY_ERROR;
goto out;
/* Get Channel ID */
tmp = silc_argument_get_arg_type(cmd->args, 3, &len);
if (!tmp) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot join channel: Bad reply packet");
COMMAND_REPLY_ERROR;
silc_free(channel_name);
hmac = silc_argument_get_arg_type(cmd->args, 11, NULL);
if (hmac) {
if (!silc_hmac_alloc(hmac, NULL, &channel->hmac)) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot join channel: Unsupported HMAC `%s'",
hmac);
COMMAND_REPLY_ERROR;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
return;
if (i == 2)
line[0] = ' ';
- cmd->client->ops->say(cmd->client, conn, "%s", line);
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
+ "%s", line);
if (!strlen(cp))
break;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
SilcClientConnection conn = (SilcClientConnection)cmd->sock->user_data;
SilcCommandStatus status;
unsigned char *tmp;
+ uint32 mode;
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
goto out;
}
+ SILC_GET32_MSB(mode, tmp);
+
/* Notify application */
- COMMAND_REPLY((ARGS, tmp));
+ COMMAND_REPLY((ARGS, mode));
/* Execute any pending command callbacks */
SILC_CLIENT_PENDING_EXEC(cmd, SILC_COMMAND_CMODE);
SilcIDCacheEntry id_cache = NULL;
SilcClientID *client_id;
unsigned char *tmp, *id;
- uint32 len;
+ uint32 len, mode;
SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
goto out;
}
+ SILC_GET32_MSB(mode, tmp);
+
/* Notify application */
- COMMAND_REPLY((ARGS, tmp, (SilcClientEntry)id_cache->context));
+ COMMAND_REPLY((ARGS, mode, (SilcClientEntry)id_cache->context));
silc_free(client_id);
/* Execute any pending command callbacks */
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;
SILC_GET32_MSB(mode, client_mode_list->data);
/* Check if we have this client cached already. */
- if (!silc_idcache_find_by_id_one_ext(conn->client_cache,
- (void *)client_id,
- NULL, NULL,
- silc_hash_client_id_compare, NULL,
- &id_cache)) {
- /* No we don't have it, query it from the server. Assemble argument
- table that will be sent fr the IDENTIFY command later. */
+ id_cache = NULL;
+ silc_idcache_find_by_id_one_ext(conn->client_cache,
+ (void *)client_id,
+ NULL, NULL,
+ silc_hash_client_id_compare, NULL,
+ &id_cache);
+
+ if (!id_cache || !((SilcClientEntry)id_cache->context)->username) {
+ /* No we don't have it (or it is incomplete in information), query
+ it from the server. Assemble argument table that will be sent
+ for the WHOIS command later. */
res_argv = silc_realloc(res_argv, sizeof(*res_argv) *
(res_argc + 1));
res_argv_lens = silc_realloc(res_argv_lens, sizeof(*res_argv_lens) *
if (res_argc) {
SilcBuffer res_cmd;
- /* Send the IDENTIFY command to server */
- res_cmd = silc_command_payload_encode(SILC_COMMAND_IDENTIFY,
+ /* Send the WHOIS command to server */
+ res_cmd = silc_command_payload_encode(SILC_COMMAND_WHOIS,
res_argc, res_argv, res_argv_lens,
res_argv_types, ++conn->cmd_ident);
silc_client_packet_send(cmd->client, conn->sock, SILC_PACKET_COMMAND,
NULL, 0, NULL, NULL, res_cmd->data, res_cmd->len,
TRUE);
- /* Register pending command callback. After we've received the IDENTIFY
+ /* Register pending command callback. After we've received the WHOIS
command reply we will reprocess this command reply by re-calling this
USERS command reply callback. */
- silc_client_command_pending(conn, SILC_COMMAND_IDENTIFY, conn->cmd_ident,
+ silc_client_command_pending(conn, SILC_COMMAND_WHOIS, conn->cmd_ident,
NULL, silc_client_command_reply_users, cmd);
silc_buffer_free(res_cmd);
tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
SILC_GET16_MSB(status, tmp);
if (status != SILC_STATUS_OK) {
- cmd->client->ops->say(cmd->client, conn,
+ cmd->client->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
"%s", silc_client_command_status_message(status));
COMMAND_REPLY_ERROR;
goto out;