From: Andrea Zagli Date: Mon, 14 Sep 2015 16:20:46 +0000 (+0200) Subject: Read reply if connected with success. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=ab31b2d0ec3da6361ed4945cd8a8a21c8f2105d9;p=libglib-mldonkey Read reply if connected with success. --- 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;