Update mumble proto to latest version.

This commit is contained in:
Auzan 2018-04-12 08:33:44 +07:00
parent 429e1a54f7
commit 38f4805660
5 changed files with 48 additions and 34 deletions

View File

@ -1,3 +1,10 @@
// Copyright 2005-2018 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
syntax = "proto2";
package MumbleProto;
option optimize_for = SPEED;
@ -63,7 +70,8 @@ message Ping {
// Sent by the server when it rejects the user connection.
message Reject {
enum RejectType {
// TODO ??
// The rejection reason is unknown (details should be available
// in Reject.reason).
None = 0;
// The client attempted to connect with an incompatible version.
WrongVersion = 1;
@ -98,7 +106,7 @@ message ServerSync {
optional uint32 max_bandwidth = 2;
// Server welcome text.
optional string welcome_text = 3;
// Current user permissions TODO: Confirm??
// Current user permissions in the root channel.
optional uint64 permissions = 4;
}
@ -134,6 +142,10 @@ message ChannelState {
optional int32 position = 9 [default = 0];
// SHA1 hash of the description if the description is 128 bytes or more.
optional bytes description_hash = 10;
// Maximum number of users allowed in the channel. If this value is zero,
// the maximum number of users allowed in the channel is given by the
// server's "usersperchannel" setting.
optional uint32 max_users = 11;
}
// Used to communicate user leaving or being kicked. May be sent by the client
@ -180,9 +192,14 @@ message UserState {
optional bool self_deaf = 10;
// User image if it is less than 128 bytes.
optional bytes texture = 11;
// TODO ??
// The positional audio plugin identifier.
// Positional audio information is only sent to users who share
// identical plugin contexts.
//
// This value is not trasmitted to clients.
optional bytes plugin_context = 12;
// TODO ??
// The user's plugin-specific identity.
// This value is not transmitted to clients.
optional string plugin_identity = 13;
// User comment if it is less than 128 bytes.
optional string comment = 14;
@ -209,7 +226,7 @@ message BanList {
required uint32 mask = 2;
// User name for identification purposes (does not affect the ban).
optional string name = 3;
// TODO ??
// The certificate hash of the banned user.
optional string hash = 4;
// Reason for the ban (does not affect the ban).
optional string reason = 5;
@ -403,9 +420,9 @@ message VoiceTarget {
message Target {
// Users that are included as targets.
repeated uint32 session = 1;
// Channels that are included as targets.
// Channel that is included as a target.
optional uint32 channel_id = 2;
// TODO ??
// ACL group that is included as a target.
optional string group = 3;
// True if the voice should follow links from the specified channel.
optional bool links = 4 [default = false];
@ -529,6 +546,8 @@ message ServerConfig {
optional uint32 message_length = 4;
// Maximum image message length.
optional uint32 image_message_length = 5;
// The maximum number of users allowed on the server.
optional uint32 max_users = 6;
}
// Sent by the server to inform the clients of suggested client configuration

View File

@ -48,8 +48,6 @@ namespace mumlib {
void disconnect();
void reconnect();
void run();
ConnectionState getConnectionState();

View File

@ -50,8 +50,6 @@ namespace mumlib {
void disconnect();
void reconnect();
ConnectionState getConnectionState() {
return state;
}

View File

@ -95,7 +95,6 @@ void mumlib::Transport::connect(
void mumlib::Transport::disconnect() {
pingTimer.cancel();
if (state != ConnectionState::NOT_CONNECTED) {
boost::system::error_code errorCode;
@ -120,16 +119,6 @@ void mumlib::Transport::disconnect() {
}
}
void mumlib::Transport::reconnect() {
boost::system::error_code errorCode;
udpSocket.close(errorCode);
if (errorCode) {
logger.warn("SSL socket close return an error: %s.", errorCode.message().c_str());
}
}
void mumlib::Transport::sendVersion() {
MumbleProto::Version version;

View File

@ -8,6 +8,7 @@
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/uuid/sha1.hpp>
#include <log4cpp/Category.hh>
#include <Mumble.pb.h>
@ -201,6 +202,9 @@ namespace mumlib {
int32_t priority_speaker = userState.has_priority_speaker() ? userState.priority_speaker() : -1;
int32_t recording = userState.has_recording() ? userState.recording() : -1;
if(session == this->sessionId) {
this->channelId = channel_id;
}
callback.userState(session,
actor,
userState.name(),
@ -381,15 +385,6 @@ namespace mumlib {
}
}
void Mumlib::reconnect() {
if (not impl->externalIoService) {
impl->ioService.reset();
}
if (impl->transport.getConnectionState() != ConnectionState::NOT_CONNECTED) {
impl->transport.disconnect();
}
}
void Mumlib::run() {
if (impl->externalIoService) {
throw MumlibException("can't call run() when using external io_service");
@ -473,8 +468,23 @@ namespace mumlib {
switch (field) {
case UserState::COMMENT:
// TODO: if comment longer than 128 bytes, we need to set the SHA1 hash
userState.set_comment(val);
if(val.size() < 128) {
userState.set_comment(val);
} else {
// if comment longer than 128 bytes, we need to set the SHA1 hash
boost::uuids::detail::sha1 sha1;
uint hash[5];
sha1.process_bytes(val.c_str(), val.size());
sha1.get_digest(hash);
std::stringstream valStream;
for(std::size_t i=0; i<sizeof(hash)/sizeof(hash[0]); ++i) {
valStream << std::hex << hash[i];
}
userState.set_comment_hash(valStream.str());
}
break;
default:
// in any other case, just ignore the command