Skip to content

Commit

Permalink
Fixed callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
pcgod committed Mar 7, 2010
1 parent 63fed3b commit d2ba7c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ void MumbleClient::ParseMessage(const MessageHeader& msg_header, void* buffer) {
case PbMessageType::TextMessage: {
MumbleProto::TextMessage tm = ConstructProtobufObject<MumbleProto::TextMessage>(buffer, msg_header.length, true);

text_message_callback_(tm.message());
if (text_message_callback_)
text_message_callback_(tm.message());
break;
}
case PbMessageType::CryptSetup: {
Expand All @@ -91,11 +92,13 @@ void MumbleClient::ParseMessage(const MessageHeader& msg_header, void* buffer) {
// Enqueue ping
DoPing(boost::system::error_code());

auth_callback_();
if (auth_callback_)
auth_callback_();
break;
}
case PbMessageType::UDPTunnel: {
raw_udp_tunnel_callback_(msg_header.length, buffer);
if (raw_udp_tunnel_callback_)
raw_udp_tunnel_callback_(msg_header.length, buffer);
break;
}
default:
Expand Down
6 changes: 3 additions & 3 deletions client.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ class MumbleClient {
void SetComment(const std::string& text);
void SendRawUdpTunnel(const char* buffer, int32_t len);

void SetTextMessageCallback(TextMessageCallbackType tm) { text_message_callback_ = tm; };
void SetAuthCallback(AuthCallbackType a) { auth_callback_ = a; };
void SetRawUdpTunnelCallback(RawUdpTunnelCallbackType rut) { raw_udp_tunnel_callback_ = rut; };
void SetTextMessageCallback(TextMessageCallbackType tm) { text_message_callback_ = tm; }
void SetAuthCallback(AuthCallbackType a) { auth_callback_ = a; }
void SetRawUdpTunnelCallback(RawUdpTunnelCallbackType rut) { raw_udp_tunnel_callback_ = rut; }
void SendUdpMessage(const char* buffer, int32_t len);

private:
Expand Down

0 comments on commit d2ba7c6

Please sign in to comment.