goto out;
}
- /* Set the topic for channel */
- silc_free(channel->topic);
- channel->topic = strdup(tmp);
-
- /* Send TOPIC_SET notify type to the network */
- silc_server_send_notify_topic_set(server, SILC_PRIMARY_ROUTE(server),
- SILC_BROADCAST(server), channel,
- client->id, SILC_ID_CLIENT,
- channel->topic);
-
- idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
-
- /* Send notify about topic change to all clients on the channel */
- silc_server_send_notify_to_channel(server, NULL, channel, FALSE,
- SILC_NOTIFY_TYPE_TOPIC_SET, 2,
- idp->data, idp->len,
- channel->topic, strlen(channel->topic));
- silc_buffer_free(idp);
+ if (!channel->topic || strcmp(channel->topic, tmp)) {
+ /* Set the topic for channel */
+ silc_free(channel->topic);
+ channel->topic = strdup(tmp);
+
+ /* Send TOPIC_SET notify type to the network */
+ silc_server_send_notify_topic_set(server, SILC_PRIMARY_ROUTE(server),
+ SILC_BROADCAST(server), channel,
+ client->id, SILC_ID_CLIENT,
+ channel->topic);
+
+ /* Send notify about topic change to all clients on the channel */
+ idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
+ silc_server_send_notify_to_channel(server, NULL, channel, FALSE,
+ SILC_NOTIFY_TYPE_TOPIC_SET, 2,
+ idp->data, idp->len,
+ channel->topic,
+ strlen(channel->topic));
+ silc_buffer_free(idp);
+ }
}
/* Send the topic to client as reply packet */
/* Check that client has rights to change any requested channel modes */
if (set_mask && !silc_server_check_cmode_rights(server, channel, chl,
mode_mask)) {
+ SILC_LOG_DEBUG(("Client does not have rights to change mode"));
silc_server_command_send_status_reply(
cmd, SILC_COMMAND_CMODE,
(!(chl->mode & SILC_CHANNEL_UMODE_CHANOP) ?
3, tmp_mask, 4);
silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY, 0,
packet->data, packet->len, FALSE);
-
+
silc_buffer_free(packet);
silc_buffer_free(cidp);
idp->data, idp->len);
silc_buffer_free(idp);
+ /* Send KICKED notify to primary route */
+ silc_server_send_notify_kicked(server, SILC_PRIMARY_ROUTE(server),
+ SILC_BROADCAST(server), channel,
+ target_client->id, client->id, comment);
+
/* 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. */
target_client, FALSE))
goto out;
- /* Send KICKED notify to primary route */
- silc_server_send_notify_kicked(server, SILC_PRIMARY_ROUTE(server),
- SILC_BROADCAST(server), channel,
- target_client->id, client->id, comment);
-
if (!(channel->mode & SILC_CHANNEL_MODE_PRIVKEY)) {
/* Re-generate channel key */
if (!silc_server_create_channel_key(server, channel, 0))