/* Channel links */
for (i = 0; ; i++) {
channel_t *ch_src, *ch_dst, *ch_itr = NULL;
+ channellist_t *chl;
if (Conf_getNextChannelLink(&chlink, i) < 0) {
if (i == 0)
Log_info("No channel links found in configuration file.");
chlink.destination);
else
ch_dst = ch_itr;
-
- list_add_tail(&ch_dst->link_node, &ch_src->channel_links);
+
+ chl = malloc(sizeof(channellist_t));
+ chl->chan = ch_dst;
+ init_list_entry(&chl->node);
+ list_add_tail(&chl->node, &ch_src->channel_links);
ch_src->linkcount++;
Log_info("Adding channel link '%s' -> '%s'", ch_src->name, ch_dst->name);
}
void Chan_free()
{
struct dlist *itr, *save;
+ struct dlist *linkitr, *linksave;
channel_t *ch;
list_iterate_safe(itr, save, &channels) {
free(ch->desc);
if (ch->password)
free(ch->password);
+ list_iterate_safe(linkitr, linksave, &ch->channel_links) {
+ channellist_t *chl;
+ chl = list_get_entry(linkitr, channellist_t, node);
+ free(chl);
+ }
free(ch);
}
}
if (vt->channels[i].linked && !list_empty(&ch->channel_links)) {
struct dlist *ch_itr;
list_iterate(ch_itr, &ch->channel_links) {
+ channellist_t *chl;
channel_t *ch_link;
- ch_link = list_get_entry(ch_itr, channel_t, link_node);
+ chl = list_get_entry(ch_itr, channellist_t, node);
+ ch_link = chl->chan;
list_iterate(itr, &ch_link->clients) {
client_t *c;
c = list_get_entry(itr, client_t, chan_node);
links = (uint32_t *)malloc(ch_itr->linkcount * sizeof(uint32_t));
list_iterate(itr, &ch_itr->channel_links) { /* Iterate links */
+ channellist_t *chl;
channel_t *ch;
- ch = list_get_entry(itr, channel_t, link_node);
+ chl = list_get_entry(itr, channellist_t, node);
+ ch = chl->chan;
links[i++] = ch->id;
}
sendmsg->payload.channelState->links = links;