aboutsummaryrefslogtreecommitdiff
path: root/src/espik_net.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/espik_net.c')
-rw-r--r--src/espik_net.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/espik_net.c b/src/espik_net.c
index e638682..c8b7652 100644
--- a/src/espik_net.c
+++ b/src/espik_net.c
@@ -93,12 +93,16 @@ void send_login()
espik_raw_send (tmp);
espik_debug_print("tmp2: %s", tmp2);
espik_raw_send (tmp2);
- espik_raw_send ("JOIN #e.fr");
+ espik_raw_send (strdup ("JOIN #e.fr"));
com_active = 1;
// espik_debug_print ("<<<<<<<< DUMMMMY CODE >>>>>>>");
+/* free (tmp);
+ free (tmp2);
+ */
+
connected++;
espik_leave();
}
@@ -122,6 +126,7 @@ void espik_con_shutdown ()
ecore_con_shutdown ();
ecore_main_loop_quit ();
+ free (server_dns);
espik_leave();
}
@@ -130,11 +135,13 @@ void espik_raw_send (char *msg)
buf_t buf;
espik_enter();
- buf = make_buffer (strlen(msg) + 2);
+ buf = make_buffer (strlen(msg) + 2); /* <MESSAGE>\r\n\0" */
- snprintf (buf.buf, buf.len, "%s\r", msg);
- /* Overid trailing \0 */
- buf.buf[strlen(buf.buf)] = '\n';
+ snprintf (buf.buf, buf.len, "%s\r\n", msg);
+ /* Override trailing \0 */
+ espik_debug_print("strlen(msg): %d", strlen(msg));
+ espik_debug_print("buf.len: %d", buf.len);
+ buf.buf[buf.len] = '\n';
espik_debug_print ("\n\nmsg(%d): %s\n\nout(%d-%d): %s\n", strlen(msg), msg, strlen(buf.buf), buf.len, buf.buf);
/*
@@ -145,15 +152,16 @@ void espik_raw_send (char *msg)
/*
int i;
- for (i = 0 ; i < buf.len ; i++)
+ for (i = 0 ; i < buf.len; i++)
{
- espik_debug_print ("buf.buf[%d]: '%c' '%d'", i, buf.buf[i], buf.buf[i]);
+ espik_debug_print ("buf.buf[%d]: '%d'", i, buf.buf[i]);
}
*/
- ret = ecore_con_server_send (con_sock, buf.buf, buf.len);
+ ret = ecore_con_server_send (con_sock, buf.buf, buf.len-1);
espik_debug_print ("ret: %d", ret);
free (buf.buf);
+// free (msg);
espik_leave();
}