From ab31b2d0ec3da6361ed4945cd8a8a21c8f2105d9 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Mon, 14 Sep 2015 18:20:46 +0200 Subject: [PATCH] Read reply if connected with success. --- src/glib-mldonkey.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/glib-mldonkey.c b/src/glib-mldonkey.c index aa68d1b..523add8 100644 --- a/src/glib-mldonkey.c +++ b/src/glib-mldonkey.c @@ -260,6 +260,9 @@ glib_mldonkey_read_message (GlibMldonkey *glibmldonkey) GError *error; guint16 l; + guint16 i; + guint8 *start; + gchar *str; GlibMldonkeyPrivate *priv = GLIB_MLDONKEY_GET_PRIVATE (glibmldonkey); @@ -333,7 +336,16 @@ glib_mldonkey_read_message (GlibMldonkey *glibmldonkey) case 19: /* ConsoleMessage */ l = bytes2guint16 (msg->data); - g_message ("strlen %d", l); + str = g_new0 (gchar, l + 1); + g_message ("strlen: %d", l); + start = msg->data + 2; + for (i = 0; i < l; i++) + { + str[i] = start[i]; + } + str[l] = '\0'; + g_message ("message: %s", str); + ret = FALSE; break; -- 2.49.0