/* Get the invite information */
tmp = silc_argument_get_arg_type(cmd->args, 4, &len);
- if (tmp) {
+ if (tmp && len > 2) {
/* Parse the arguments to see they are constructed correctly */
SILC_GET16_MSB(argc, tmp);
args = silc_argument_payload_parse(tmp + 2, len - 2, argc);
/* 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(
silc_argument_get_arg_type(cmd->args, 3, NULL),
list);
+ /* Send invite list back only if the list was modified, or now arguments
+ was given. */
+ type = 0;
+ argc = silc_argument_get_arg_num(cmd->args);
+ if (argc == 1)
+ type = 1;
+ if (silc_argument_get_arg_type(cmd->args, 3, &len))
+ type = 1;
+
/* Send command reply */
tmp = silc_argument_get_arg_type(cmd->args, 1, &len);
packet = silc_command_reply_payload_encode_va(SILC_COMMAND_INVITE,
SILC_STATUS_OK, 0, ident, 2,
2, tmp, len,
- 3, list ? list->data : NULL,
- list ? list->len : 0);
+ 3, type && list ?
+ list->data : NULL,
+ type && list ? list->len : 0);
silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
packet->data, packet->len, FALSE);
silc_buffer_free(packet);
/* Do normal signoff for the destination client */
sock = remote_client->connection;
+ silc_server_remove_from_channels(server, NULL, remote_client,
+ TRUE, (char *)"Killed", TRUE, TRUE);
silc_server_free_client_data(server, NULL, remote_client, TRUE,
comment ? comment :
(unsigned char *)"Killed");
/* 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 ban information */
tmp = silc_argument_get_arg_type(cmd->args, 3, &len);
- if (tmp) {
+ if (tmp && len > 2) {
/* Parse the arguments to see they are constructed correctly */
SILC_GET16_MSB(argc, tmp);
args = silc_argument_payload_parse(tmp + 2, len - 2, argc);
}
/* 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(