/* Encode invite list */
list = NULL;
- if (channel->invite_list) {
+ if (channel->invite_list && silc_hash_table_count(channel->invite_list)) {
list = silc_buffer_alloc_size(2);
silc_buffer_format(list,
SILC_STR_UI_SHORT(silc_hash_table_count(
/* Check invite list if channel is invite-only channel */
if (channel->mode & SILC_CHANNEL_MODE_INVITE) {
if (!channel->invite_list ||
+ !silc_hash_table_count(channel->invite_list) ||
(!silc_server_inviteban_match(server, channel->invite_list,
3, client->id) &&
!silc_server_inviteban_match(server, channel->invite_list,
/* Check ban list if it exists. If the client's nickname, server,
username and/or hostname is in the ban list the access to the
channel is denied. */
- if (channel->ban_list) {
- if (silc_server_inviteban_match(server, channel->invite_list,
+ if (channel->ban_list && silc_hash_table_count(channel->ban_list)) {
+ if (silc_server_inviteban_match(server, channel->ban_list,
3, client->id) ||
- silc_server_inviteban_match(server, channel->invite_list,
+ silc_server_inviteban_match(server, channel->ban_list,
2, client->data.public_key) ||
- !silc_server_inviteban_match(server, channel->invite_list,
+ !silc_server_inviteban_match(server, channel->ban_list,
1, check) ||
- !silc_server_inviteban_match(server, channel->invite_list,
+ !silc_server_inviteban_match(server, channel->ban_list,
1, check2)) {
silc_server_command_send_status_reply(
cmd, SILC_COMMAND_JOIN,
/* Encode invite list */
invite_list = NULL;
- if (channel->invite_list) {
+ if (channel->invite_list && silc_hash_table_count(channel->invite_list)) {
SilcHashTableList htl;
invite_list = silc_buffer_alloc_size(2);
/* Encode ban list */
ban_list = NULL;
- if (channel->ban_list) {
+ if (channel->ban_list && silc_hash_table_count(channel->ban_list)) {
SilcHashTableList htl;
ban_list = silc_buffer_alloc_size(2);
SILC_BROADCAST(server), channel,
target_client->id, client->id, comment);
+ /* Remove the client from channel's invite list */
+ if (channel->invite_list && silc_hash_table_count(channel->invite_list)) {
+ SilcBuffer ab =
+ silc_argument_payload_encode_one(NULL, target_idp, target_idp_len, 3);
+ SilcArgumentPayload args =
+ silc_argument_payload_parse(ab->data, ab->len, 1);
+ silc_server_inviteban_process(server, channel->invite_list, 1, args);
+ silc_buffer_free(ab);
+ silc_argument_payload_free(args);
+ }
+
/* Remove the client from the channel. If the channel does not exist
after removing the client then the client kicked itself off the channel
and we don't have to send anything after that. */
}
/* Get the type of action */
- tmp = silc_argument_get_arg_type(cmd->args, 3, &len);
+ tmp = silc_argument_get_arg_type(cmd->args, 2, &len);
if (tmp && len == 1) {
if (tmp[0] == 0x00) {
/* Allocate hash table for ban list if it doesn't exist yet */
/* Encode ban list */
list = NULL;
- if (channel->ban_list) {
+ if (channel->ban_list && silc_hash_table_count(channel->ban_list)) {
list = silc_buffer_alloc_size(2);
silc_buffer_format(list,
SILC_STR_UI_SHORT(silc_hash_table_count(
if (chl->mode & SILC_CHANNEL_UMODE_CHANFO)
goto out;
- /* From protocol version 1.1 we get the kicker's ID as well. */
+ /* Get the kicker's Client ID */
tmp = silc_argument_get_arg_type(args, 3, &tmp_len);
- if (tmp) {
- client_id = silc_id_payload_parse_id(tmp, tmp_len, NULL);
- if (!client_id)
- goto out;
+ if (!tmp)
+ goto out;
+ client_id = silc_id_payload_parse_id(tmp, tmp_len, NULL);
+ if (!client_id)
+ goto out;
- /* If the the client is not in local list we check global list */
- client2 = silc_idlist_find_client_by_id(server->global_list,
+ /* If the the client is not in local list we check global list */
+ client2 = silc_idlist_find_client_by_id(server->global_list,
+ client_id, TRUE, NULL);
+ if (!client2) {
+ client2 = silc_idlist_find_client_by_id(server->local_list,
client_id, TRUE, NULL);
if (!client2) {
- client2 = silc_idlist_find_client_by_id(server->local_list,
- client_id, TRUE, NULL);
- if (!client2) {
- silc_free(client_id);
- goto out;
- }
- }
- silc_free(client_id);
-
- /* Kicker must be operator on channel */
- if (!silc_server_client_on_channel(client2, channel, &chl))
- goto out;
- if (!(chl->mode & SILC_CHANNEL_UMODE_CHANOP) &&
- !(chl->mode & SILC_CHANNEL_UMODE_CHANFO)) {
- SILC_LOG_DEBUG(("Kicking is not allowed"));
+ silc_free(client_id);
goto out;
}
}
+ silc_free(client_id);
+
+ /* Kicker must be operator on channel */
+ if (!silc_server_client_on_channel(client2, channel, &chl))
+ goto out;
+ if (!(chl->mode & SILC_CHANNEL_UMODE_CHANOP) &&
+ !(chl->mode & SILC_CHANNEL_UMODE_CHANFO)) {
+ SILC_LOG_DEBUG(("Kicking is not allowed"));
+ goto out;
+ }
/* Send to channel */
silc_server_packet_send_to_channel(server, sock, channel, packet->type,
FALSE, packet->buffer->data,
packet->buffer->len, FALSE);
+ /* Remove the client from channel's invite list */
+ if (channel->invite_list && silc_hash_table_count(channel->invite_list)) {
+ SilcBuffer ab;
+ SilcArgumentPayload iargs;
+ tmp = silc_argument_get_arg_type(args, 1, &tmp_len);
+ ab = silc_argument_payload_encode_one(NULL, tmp, tmp_len, 3);
+ iargs = silc_argument_payload_parse(ab->data, ab->len, 1);
+ silc_server_inviteban_process(server, channel->invite_list, 1, iargs);
+ silc_buffer_free(ab);
+ silc_argument_payload_free(iargs);
+ }
+
/* Remove the client from channel */
silc_server_remove_from_one_channel(server, sock, channel, client, FALSE);
if (comment_len > 128)
comment_len = 127;
- /* From protocol version 1.1 we get the killer's ID as well. */
+ /* Get the killer's Client ID */
tmp = silc_argument_get_arg_type(args, 3, &tmp_len);
- if (tmp) {
- client_id = silc_id_payload_parse_id(tmp, tmp_len, &id_type);
- if (!client_id)
- goto out;
+ if (!tmp)
+ goto out;
+ client_id = silc_id_payload_parse_id(tmp, tmp_len, &id_type);
+ if (!client_id)
+ goto out;
- if (id_type == SILC_ID_CLIENT) {
- /* If the the client is not in local list we check global list */
- client2 = silc_idlist_find_client_by_id(server->global_list,
+ if (id_type == SILC_ID_CLIENT) {
+ /* If the the client is not in local list we check global list */
+ client2 = silc_idlist_find_client_by_id(server->global_list,
+ client_id, TRUE, NULL);
+ if (!client2) {
+ client2 = silc_idlist_find_client_by_id(server->local_list,
client_id, TRUE, NULL);
if (!client2) {
- client2 = silc_idlist_find_client_by_id(server->local_list,
- client_id, TRUE, NULL);
- if (!client2) {
- silc_free(client_id);
- goto out;
- }
- }
- silc_free(client_id);
-
- /* Killer must be router operator */
- if (server->server_type != SILC_SERVER &&
- !(client2->mode & SILC_UMODE_ROUTER_OPERATOR)) {
- SILC_LOG_DEBUG(("Killing is not allowed"));
+ silc_free(client_id);
goto out;
}
}
+ silc_free(client_id);
+
+ /* Killer must be router operator */
+ if (server->server_type != SILC_SERVER &&
+ !(client2->mode & SILC_UMODE_ROUTER_OPERATOR)) {
+ SILC_LOG_DEBUG(("Killing is not allowed"));
+ goto out;
+ }
}
/* Send the notify to local clients on the channels except to the