summaryrefslogtreecommitdiff
path: root/src/cmumble.c
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-02-16 11:18:16 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-11-18 13:22:05 +0100
commita70acff952f417ac4f9df750bd59aa4c9cdb01d4 (patch)
tree2a3065861f5002ae5d195236d2cec572d5ea6217 /src/cmumble.c
parentb917bc69384a2e636a717a8730ad5105f7b2bf1a (diff)
downloadcmumble-a70acff952f417ac4f9df750bd59aa4c9cdb01d4.tar.gz
cmumble-a70acff952f417ac4f9df750bd59aa4c9cdb01d4.tar.bz2
cmumble-a70acff952f417ac4f9df750bd59aa4c9cdb01d4.zip
Add verbose option
Disable all debug output using that flag for now.
Diffstat (limited to 'src/cmumble.c')
-rw-r--r--src/cmumble.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/cmumble.c b/src/cmumble.c
index 350db56..8d5c495 100644
--- a/src/cmumble.c
+++ b/src/cmumble.c
@@ -48,8 +48,10 @@ recv_udp_tunnel(MumbleProto__UDPTunnel *tunnel, struct cmumble *cm)
static void
recv_version(MumbleProto__Version *version, struct cmumble *cm)
{
- g_print("version: 0x%x\n", version->version);
- g_print("release: %s\n", version->release);
+ if (cm->verbose) {
+ g_print("version: 0x%x\n", version->version);
+ g_print("release: %s\n", version->release);
+ }
}
static void
@@ -92,7 +94,8 @@ recv_server_sync(MumbleProto__ServerSync *sync, struct cmumble *cm)
if (sync->welcome_text)
g_print("Welcome Message: %s\n", sync->welcome_text);
- g_print("got session: %d\n", cm->session);
+ if (cm->verbose)
+ g_print("got session: %d\n", cm->session);
}
static void
@@ -126,8 +129,9 @@ static void
recv_codec_version(MumbleProto__CodecVersion *codec,
struct cmumble *cm)
{
- g_print("Codec Version: alpha: %d, beta: %d, pefer_alpha: %d\n",
- codec->alpha, codec->beta, codec->prefer_alpha);
+ if (cm->verbose)
+ g_print("Codec Version: alpha: %d, beta: %d, pefer_alpha: %d\n",
+ codec->alpha, codec->beta, codec->prefer_alpha);
}
static void
@@ -170,7 +174,8 @@ recv_user_state(MumbleProto__UserState *state, struct cmumble *cm)
cm->user = user;
cmumble_audio_create_playback_pipeline(cm, user);
- g_print("receive user: %s\n", user->name);
+ if (cm->verbose)
+ g_print("receive user: %s\n", user->name);
cm->users = g_list_prepend(cm->users, user);
}
@@ -282,6 +287,7 @@ cmumble_protocol_init(struct cmumble *cm)
gchar *user = "unkown";
gchar *host = "localhost";
gint port = 64738;
+gboolean verbose = FALSE;
static GOptionEntry entries[] = {
{
@@ -296,6 +302,10 @@ static GOptionEntry entries[] = {
"port", 'p', 0, G_OPTION_ARG_INT, &port,
"port of the mumble server", "N"
},
+ {
+ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
+ "Turn on verbosity", NULL
+ },
{ NULL }
};
@@ -318,6 +328,7 @@ int main(int argc, char **argv)
cm.user_name = user;
cm.users = NULL;
+ cm.verbose = verbose;
g_type_init();
cm.loop = g_main_loop_new(NULL, FALSE);