projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merged silc_1_1_branch to trunk.
[silc.git]
/
lib
/
silcclient
/
command_reply.c
diff --git
a/lib/silcclient/command_reply.c
b/lib/silcclient/command_reply.c
index 73e45893ef9f4011f0eb460b2b0b74453ba9c2f0..61e4d73a082dea7df0a86f0d6791a9576612b313 100644
(file)
--- a/
lib/silcclient/command_reply.c
+++ b/
lib/silcclient/command_reply.c
@@
-127,7
+127,7
@@
static void silc_client_command_process_error(SilcClientCommandContext cmd,
if (cmd->error == SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID) {
SilcChannelEntry channel;
if (cmd->error == SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID) {
SilcChannelEntry channel;
- /* Remove unknown c
lient
entry from cache */
+ /* Remove unknown c
hannel
entry from cache */
if (!silc_argument_get_decoded(args, 2, SILC_ARGUMENT_ID, &id, NULL))
return;
if (!silc_argument_get_decoded(args, 2, SILC_ARGUMENT_ID, &id, NULL))
return;
@@
-143,7
+143,7
@@
static void silc_client_command_process_error(SilcClientCommandContext cmd,
if (cmd->error == SILC_STATUS_ERR_NO_SUCH_SERVER_ID) {
SilcServerEntry server_entry;
if (cmd->error == SILC_STATUS_ERR_NO_SUCH_SERVER_ID) {
SilcServerEntry server_entry;
- /* Remove unknown
client
entry from cache */
+ /* Remove unknown
server
entry from cache */
if (!silc_argument_get_decoded(args, 2, SILC_ARGUMENT_ID, &id, NULL))
return;
if (!silc_argument_get_decoded(args, 2, SILC_ARGUMENT_ID, &id, NULL))
return;
@@
-221,7
+221,7
@@
SILC_FSM_STATE(silc_client_command_reply_wait)
/** Wait for command reply */
silc_fsm_set_state_context(fsm, NULL);
silc_fsm_next_later(fsm, silc_client_command_reply_timeout,
/** Wait for command reply */
silc_fsm_set_state_context(fsm, NULL);
silc_fsm_next_later(fsm, silc_client_command_reply_timeout,
- cmd->cmd != SILC_COMMAND_PING ?
25
: 60, 0);
+ cmd->cmd != SILC_COMMAND_PING ?
40
: 60, 0);
return SILC_FSM_WAIT;
}
return SILC_FSM_WAIT;
}
@@
-514,7
+514,7
@@
SILC_FSM_STATE(silc_client_command_reply_whois)
silc_client_unref_client(client, conn, client_entry);
if (has_channels) {
silc_client_unref_client(client, conn, client_entry);
if (has_channels) {
- silc_
dlist_uninit
(channel_list);
+ silc_
channel_payload_list_free
(channel_list);
silc_free(umodes);
}
silc_free(umodes);
}
@@
-677,7
+677,8
@@
SILC_FSM_STATE(silc_client_command_reply_identify)
}
/* Notify application */
}
/* Notify application */
- silc_client_command_callback(cmd, channel_entry, name, info);
+ silc_client_command_callback(cmd, channel_entry,
+ channel_entry->channel_name, info);
silc_client_unref_channel(client, conn, channel_entry);
break;
}
silc_client_unref_channel(client, conn, channel_entry);
break;
}
@@
-732,6
+733,7
@@
SILC_FSM_STATE(silc_client_command_reply_nick)
if (!silc_client_change_nickname(client, conn, conn->local_entry,
nick, &id.u.client_id, idp, idp_len)) {
ERROR_CALLBACK(SILC_STATUS_ERR_BAD_NICKNAME);
if (!silc_client_change_nickname(client, conn, conn->local_entry,
nick, &id.u.client_id, idp, idp_len)) {
ERROR_CALLBACK(SILC_STATUS_ERR_BAD_NICKNAME);
+ silc_rwlock_unlock(conn->local_entry->internal.lock);
goto out;
}
goto out;
}
@@
-800,7
+802,8
@@
SILC_FSM_STATE(silc_client_command_reply_list)
}
/* Notify application */
}
/* Notify application */
- silc_client_command_callback(cmd, channel_entry, name, topic, usercount);
+ silc_client_command_callback(cmd, channel_entry, channel_entry->channel_name,
+ topic, usercount);
out:
silc_client_unref_channel(client, conn, channel_entry);
out:
silc_client_unref_channel(client, conn, channel_entry);
@@
-1252,8
+1255,8
@@
SILC_FSM_STATE(silc_client_command_reply_join)
}
/* Get channel mode */
}
/* Get channel mode */
- tmp = silc_argument_get_arg_type(args, 5,
NULL
);
- if (tmp)
+ tmp = silc_argument_get_arg_type(args, 5,
&len
);
+ if (tmp
&& len == 4
)
SILC_GET32_MSB(mode, tmp);
channel->mode = mode;
SILC_GET32_MSB(mode, tmp);
channel->mode = mode;
@@
-1290,7
+1293,7
@@
SILC_FSM_STATE(silc_client_command_reply_join)
/* Get channel public key list */
tmp = silc_argument_get_arg_type(args, 16, &len);
if (tmp)
/* 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;
/* Set current channel */
conn->current_channel = channel;
@@
-1302,7
+1305,7
@@
SILC_FSM_STATE(silc_client_command_reply_join)
silc_hash_table_list(channel->user_list, &htl);
/* Notify application */
silc_hash_table_list(channel->user_list, &htl);
/* Notify application */
- silc_client_command_callback(cmd, channel_name, channel, mode, &htl,
+ silc_client_command_callback(cmd, channel
->channel
_name, channel, mode, &htl,
topic, cipher, hmac, channel->founder_key,
channel->channel_pubkeys, channel->user_limit);
topic, cipher, hmac, channel->founder_key,
channel->channel_pubkeys, channel->user_limit);
@@
-1420,7
+1423,6
@@
SILC_FSM_STATE(silc_client_command_reply_cmode)
SilcChannelEntry channel;
SilcUInt32 len;
SilcPublicKey public_key = NULL;
SilcChannelEntry channel;
SilcUInt32 len;
SilcPublicKey public_key = NULL;
- SilcDList channel_pubkeys = NULL;
SilcID id;
/* Sanity checks */
SilcID id;
/* Sanity checks */
@@
-1440,24
+1442,21
@@
SILC_FSM_STATE(silc_client_command_reply_cmode)
goto out;
}
goto out;
}
+ /* Get founder public key */
+ tmp = silc_argument_get_arg_type(args, 4, &len);
+ if (tmp)
+ silc_public_key_payload_decode(tmp, len, &public_key);
+
/* Get channel mode */
tmp = silc_argument_get_arg_type(args, 3, &len);
if (!tmp || len != 4) {
ERROR_CALLBACK(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
goto out;
}
/* Get channel mode */
tmp = silc_argument_get_arg_type(args, 3, &len);
if (!tmp || len != 4) {
ERROR_CALLBACK(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
goto out;
}
-
- /* Get founder public key */
- tmp = silc_argument_get_arg_type(args, 4, &len);
- if (tmp)
- silc_public_key_payload_decode(tmp, len, &public_key);
+ SILC_GET32_MSB(mode, tmp);
silc_rwlock_wrlock(channel->internal.lock);
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 user limit */
tmp = silc_argument_get_arg_type(args, 6, &len);
if (tmp && len == 4)
@@
-1468,15
+1467,18
@@
SILC_FSM_STATE(silc_client_command_reply_cmode)
/* Get channel public key(s) */
tmp = silc_argument_get_arg_type(args, 5, &len);
if (tmp)
/* 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,
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)
out:
if (public_key)
@@
-1623,6
+1625,9
@@
SILC_FSM_STATE(silc_client_command_reply_silcoper)
CHECK_STATUS("Cannot change mode: ");
CHECK_ARGS(1, 1);
CHECK_STATUS("Cannot change mode: ");
CHECK_ARGS(1, 1);
+ /* Set user mode */
+ cmd->conn->local_entry->mode |= SILC_UMODE_ROUTER_OPERATOR;
+
/* Notify application */
silc_client_command_callback(cmd);
/* Notify application */
silc_client_command_callback(cmd);
@@
-1642,6
+1647,9
@@
SILC_FSM_STATE(silc_client_command_reply_oper)
CHECK_STATUS("Cannot change mode: ");
CHECK_ARGS(1, 1);
CHECK_STATUS("Cannot change mode: ");
CHECK_ARGS(1, 1);
+ /* Set user mode */
+ cmd->conn->local_entry->mode |= SILC_UMODE_SERVER_OPERATOR;
+
/* Notify application */
silc_client_command_callback(cmd);
/* Notify application */
silc_client_command_callback(cmd);
@@
-1940,6
+1948,8
@@
SILC_FSM_STATE(silc_client_command_reply_users)
}
}
}
}
+ silc_rwlock_unlock(channel->internal.lock);
+
/* Notify application */
silc_hash_table_list(channel->user_list, &htl);
silc_client_command_callback(cmd, channel, &htl);
/* Notify application */
silc_hash_table_list(channel->user_list, &htl);
silc_client_command_callback(cmd, channel, &htl);