X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fmessagehandler.c;h=1e49241890d6252664522f06177a88a3d956e49a;hb=36601a5de5f90e16188deadd271b70595b4cc237;hp=faffea26b4204a697a928747145496ed740af39a;hpb=fcbffe3b098a3758270a155b2285721e85bc85e5;p=umurmur.git diff --git a/src/messagehandler.c b/src/messagehandler.c index faffea2..1e49241 100644 --- a/src/messagehandler.c +++ b/src/messagehandler.c @@ -1,5 +1,5 @@ -/* Copyright (C) 2009-2012, Martin Johansson - Copyright (C) 2005-2012, Thorvald Natvig +/* Copyright (C) 2009-2013, Martin Johansson + Copyright (C) 2005-2013, Thorvald Natvig All rights reserved. @@ -247,24 +247,7 @@ void Mh_handle_message(client_t *client, message_t *msg) Client_send_message(client, sendmsg); if (!bOpus && client->bOpus && fake_celt_support) { - char *message; - uint32_t *tree_id; - message_t *sendmsg = NULL; - - message = malloc(strlen(NO_CELT_MESSAGE) + 1); - if (!message) - Log_fatal("Out of memory"); - tree_id = malloc(sizeof(uint32_t)); - if (!tree_id) - Log_fatal("Out of memory"); - *tree_id = 0; - sendmsg = Msg_create(TextMessage); - sendmsg->payload.textMessage->message = message; - sendmsg->payload.textMessage->n_tree_id = 1; - sendmsg->payload.textMessage->tree_id = tree_id; - sprintf(message, NO_CELT_MESSAGE); - Client_send_message(client, sendmsg); - sendmsg = NULL; + Client_textmessage(client, NO_CELT_MESSAGE); } /* Iterate channels and send channel info */ @@ -280,6 +263,10 @@ void Mh_handle_message(client_t *client, message_t *msg) 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); } @@ -745,6 +732,8 @@ void Mh_handle_message(client_t *client, message_t *msg) 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; @@ -834,9 +823,12 @@ void Mh_handle_message(client_t *client, message_t *msg) sendmsg->payload.userStats->version->has_version = true; sendmsg->payload.userStats->version->version = target->version; - sendmsg->payload.userStats->version->release = strdup(target->release); - sendmsg->payload.userStats->version->os = strdup(target->os); - sendmsg->payload.userStats->version->os_version = strdup(target->os_version); + if (target->release) + sendmsg->payload.userStats->version->release = strdup(target->release); + if (target->os) + sendmsg->payload.userStats->version->os = strdup(target->os); + if (target->os_version) + sendmsg->payload.userStats->version->os_version = strdup(target->os_version); sendmsg->payload.userStats->n_celt_versions = target->codec_count; sendmsg->payload.userStats->celt_versions = malloc(sizeof(int32_t) * target->codec_count); @@ -846,6 +838,7 @@ void Mh_handle_message(client_t *client, message_t *msg) while (Client_codec_iterate(target, &codec_itr) != NULL) sendmsg->payload.userStats->celt_versions[i++] = codec_itr->codec; + sendmsg->payload.userStats->has_opus = true; sendmsg->payload.userStats->opus = target->bOpus; /* Address */