+ case UDPTunnel:
+ client->bUDP = false;
+ Client_voiceMsg(client, msg->payload.UDPTunnel->packet.data, msg->payload.UDPTunnel->packet.len);
+ break;
+ case ChannelState:
+ {
+ channel_t *ch_itr, *parent, *newchan;
+ int leave_id;
+ /* Don't allow any changes to existing channels */
+ if (msg->payload.channelState->has_channel_id) {
+ sendPermissionDenied(client, "Not supported by uMurmur");
+ break;
+ }
+ /* Must have parent */
+ if (!msg->payload.channelState->has_parent) {
+ sendPermissionDenied(client, "Not supported by uMurmur");
+ break;
+ }
+ /* Must have name */
+ if (msg->payload.channelState->name == NULL) {
+ sendPermissionDenied(client, "Not supported by uMurmur");
+ break;
+ }
+ /* Must be temporary channel */
+ if (msg->payload.channelState->temporary != true) {
+ sendPermissionDenied(client, "Only temporary channels are supported by uMurmur");
+ break;
+ }
+ /* Check channel name is OK */
+ if (strlen(msg->payload.channelState->name) > MAX_TEXT) {
+ sendPermissionDenied(client, "Channel name too long");
+ break;
+ }
+
+ parent = Chan_fromId(msg->payload.channelState->parent);
+ if (parent == NULL)
+ break;
+ ch_itr = NULL;
+ while (Chan_iterate_siblings(parent, &ch_itr) != NULL) {
+ if (strcmp(ch_itr->name, msg->payload.channelState->name) == 0) {
+ sendPermissionDenied(client, "Channel already exists");
+ break;
+ }
+ }
+ if (ch_itr != NULL)
+ break;
+
+ /* Disallow temporary channels as siblings to temporary channels */
+ if (parent->temporary) {
+ sendPermissionDenied(client, "Parent channel is temporary channel");
+ break;
+ }
+
+ /* XXX - Murmur looks for "\\w" and sends perm denied if not found.
+ * I don't know why so I don't do that here...
+ */
+
+ /* Create the channel */
+ newchan = Chan_createChannel(msg->payload.channelState->name,
+ msg->payload.channelState->description);
+ newchan->temporary = true;
+ Chan_addChannel(parent, newchan);
+ msg->payload.channelState->has_channel_id = true;
+ msg->payload.channelState->channel_id = newchan->id;
+ Msg_inc_ref(msg);
+ Client_send_message_except(NULL, msg);
+
+ /* Join the creating user */
+ sendmsg = Msg_create(UserState);
+ sendmsg->payload.userState->has_session = true;
+ sendmsg->payload.userState->session = client->sessionId;
+ sendmsg->payload.userState->has_channel_id = true;
+ sendmsg->payload.userState->channel_id = newchan->id;
+ Client_send_message_except(NULL, sendmsg);
+
+ leave_id = Chan_userJoin(newchan, client);
+ if (leave_id > 0) {
+ Log_debug("Removing channel ID %d", leave_id);
+ sendmsg = Msg_create(ChannelRemove);
+ sendmsg->payload.channelRemove->channel_id = leave_id;
+ Client_send_message_except(NULL, sendmsg);
+ }
+ }
+ break;
+
+ case UserStats:
+ {
+ client_t *target = NULL;
+ codec_t *codec_itr = NULL;
+ int i;
+ bool_t details = true;
+
+ if (msg->payload.userStats->has_stats_only)
+ details = !msg->payload.userStats->stats_only;
+
+ if (!msg->payload.userStats->has_session)
+ sendPermissionDenied(client, "Not supported by uMurmur");
+ while (Client_iterate(&target) != NULL) {
+ if (!IS_AUTH(target))
+ continue;
+ if (target->sessionId == msg->payload.userStats->session)
+ break;
+ }
+ if (!target) /* Not found */
+ break;
+
+ /*
+ * Differences from Murmur:
+ * o Ignoring certificates intentionally
+ * o Ignoring channel local determining
+ */
+
+ sendmsg = Msg_create(UserStats);
+ sendmsg->payload.userStats->session = msg->payload.userStats->session;
+ sendmsg->payload.userStats->from_client->has_good = true;
+ sendmsg->payload.userStats->from_client->good = target->cryptState.uiGood;
+ sendmsg->payload.userStats->from_client->has_late = true;
+ sendmsg->payload.userStats->from_client->late = target->cryptState.uiLate;
+ sendmsg->payload.userStats->from_client->has_lost = true;
+ sendmsg->payload.userStats->from_client->lost = target->cryptState.uiLost;
+ sendmsg->payload.userStats->from_client->has_resync = true;
+ sendmsg->payload.userStats->from_client->resync = target->cryptState.uiResync;
+
+ sendmsg->payload.userStats->from_server->has_good = true;
+ sendmsg->payload.userStats->from_server->good = target->cryptState.uiRemoteGood;
+ sendmsg->payload.userStats->from_server->has_late = true;
+ sendmsg->payload.userStats->from_server->late = target->cryptState.uiRemoteLate;
+ sendmsg->payload.userStats->from_server->has_lost = true;
+ sendmsg->payload.userStats->from_server->lost = target->cryptState.uiRemoteLost;
+ sendmsg->payload.userStats->from_server->has_resync = true;
+ sendmsg->payload.userStats->from_server->resync = target->cryptState.uiRemoteResync;