channel_t *ch, *ch_itr = NULL;
ch = Chan_createChannel(chdesc.name, chdesc.description);
ch->noenter = chdesc.noenter;
+ ch->position = chdesc.position;
if (chdesc.password) {
Log_info("Setting password on channel '%s'", ch->name);
ch->password = strdup(chdesc.password);
chdesc->silent = false;
else
chdesc->silent = config_setting_get_bool(setting);
+
+ ret = snprintf(configstr, maxconfig, "channels.[%d].position", index);
+ setting = config_lookup(&configuration, configstr);
+ if (ret >= maxconfig || ret < 0 || setting == NULL) /* Optional */
+ chdesc->position = 0;
+ else
+ chdesc->position = config_setting_get_int(setting);
return 0;
}
sendmsg->payload.channelState->name = strdup(ch_itr->name);
if (ch_itr->desc)
sendmsg->payload.channelState->description = strdup(ch_itr->desc);
+ if (ch_itr->position != 0) {
+ sendmsg->payload.channelState->has_position = true;
+ sendmsg->payload.channelState->position = ch_itr->position;
+ }
Log_debug("Send channel info: %s", sendmsg->payload.channelState->name);
Client_send_message(client, sendmsg);
}
newchan = Chan_createChannel(msg->payload.channelState->name,
msg->payload.channelState->description);
newchan->temporary = true;
+ if (msg->payload.channelState->has_position)
+ newchan->position = msg->payload.channelState->position;
Chan_addChannel(parent, newchan);
msg->payload.channelState->has_channel_id = true;
msg->payload.channelState->channel_id = newchan->id;