X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Fsilcd%2Fcommand.c;h=f0889aef33e4c049250ea4ce15a181ae122ea7fe;hb=6598e3df6635ec0e44caec364bc4f3bd58d2728f;hp=992402a8bf98a0f67e174c89944d8abaee0a9fbc;hpb=6b6b1b00eeea0a5a9faac129cba3f3a4e46fec16;p=silc.git diff --git a/apps/silcd/command.c b/apps/silcd/command.c index 992402a8..f0889aef 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -2440,24 +2440,26 @@ SILC_SERVER_CMD_FUNC(topic) 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 */ @@ -4010,6 +4012,7 @@ SILC_SERVER_CMD_FUNC(cmode) /* 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) ?