]> saetta.ns0.it Git - libglib-mldonkey/commitdiff
Read reply if connected with success. master
authorAndrea Zagli <azagli@libero.it>
Mon, 14 Sep 2015 16:20:46 +0000 (18:20 +0200)
committerAndrea Zagli <azagli@libero.it>
Mon, 14 Sep 2015 16:20:46 +0000 (18:20 +0200)
src/glib-mldonkey.c

index aa68d1b8bbe5f21676b0d5b871a13ad4deafb7b9..523add83beae6096fdd7e1cce254c4aef86ab347 100644 (file)
@@ -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;