+ Client_send_voice(client, c, buffer, pds->offset + 1, poslen);
+ }
+ } else if ((vt = Voicetarget_get_id(client, target)) != NULL) { /* Targeted whisper */
+ int i;
+ channel_t *ch;
+ /* Channels */
+ for (i = 0; i < TARGET_MAX_CHANNELS && vt->channels[i].channel != -1; i++) {
+ buffer[0] = (uint8_t) (type | 1);
+ Log_debug("Whisper channel %d", vt->channels[i]);
+ ch = Chan_fromId(vt->channels[i].channel);
+ if (ch == NULL)
+ continue;
+ list_iterate(itr, &ch->clients) {
+ client_t *c;
+ c = list_get_entry(itr, client_t, chan_node);
+ Client_send_voice(client, c, buffer, pds->offset + 1, poslen);
+ }
+ /* Channel links */
+ if (vt->channels[i].linked && !list_empty(&ch->channel_links)) {
+ struct dlist *ch_itr;
+ list_iterate(ch_itr, &ch->channel_links) {
+ channel_t *ch_link;
+ ch_link = list_get_entry(ch_itr, channel_t, link_node);
+ list_iterate(itr, &ch_link->clients) {
+ client_t *c;
+ c = list_get_entry(itr, client_t, chan_node);
+ Log_debug("Linked voice from %s -> %s", ch->name, ch_link->name);
+ Client_send_voice(client, c, buffer, pds->offset + 1, poslen);
+ }
+ }
+ }
+ /* children */
+ if (vt->channels[i].children) {
+ struct dlist chanlist, *ch_itr;
+ init_list_entry(&chanlist);
+ Chan_buildTreeList(ch, &chanlist);
+ list_iterate(ch_itr, &chanlist) {
+ channel_t *sub;
+ sub = list_get_entry(ch_itr, channellist_t, node)->chan;
+ list_iterate(itr, &sub->clients) {
+ client_t *c;
+ c = list_get_entry(itr, client_t, chan_node);
+ Log_debug("Child voice from %s -> %s", ch->name, sub->name);
+ Client_send_voice(client, c, buffer, pds->offset + 1, poslen);
+ }
+ }
+ Chan_freeTreeList(&chanlist);
+ }
+ }
+ /* Sessions */
+ for (i = 0; i < TARGET_MAX_SESSIONS && vt->sessions[i] != -1; i++) {
+ client_t *c;
+ buffer[0] = (uint8_t) (type | 2);
+ Log_debug("Whisper session %d", vt->sessions[i]);
+ while (Client_iterate(&c) != NULL) {
+ if (c->sessionId == vt->sessions[i]) {
+ Client_send_voice(client, c, buffer, pds->offset + 1, poslen);
+ break;
+ }