From b69b9e7cbd635fb4932bbecea783c2d224a943f0 Mon Sep 17 00:00:00 2001 From: beber Date: Wed, 7 Dec 2005 15:35:35 +0000 Subject: Okey ! make user_infos global move connection process to when we ARE connected, do nothing in this time --- src/espik.c | 21 ++------------------- src/espik.h | 2 ++ src/espik_net.c | 21 +++++++++++++++++++-- 3 files changed, 23 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/espik.c b/src/espik.c index 598077f..c4166be 100644 --- a/src/espik.c +++ b/src/espik.c @@ -42,7 +42,6 @@ int del_backslash (char *msg) int main (int argc, char **argv) { - t_info a_infos; Ecore_Fd_Handler *fd_kb; printf ("Welcome to %s %s\n", APPS_NAME, ESPIK_VERSION); @@ -50,7 +49,6 @@ int main (int argc, char **argv) #ifdef _ESPIK_DEBUG_ espik_debug_init(); #endif - espik_config_init (); if (argc < 3) @@ -78,7 +76,6 @@ int main (int argc, char **argv) espik_debug_print ("Cannot init ecore; %d", 1); exit (-1); } - espik_con_init (a_infos); /* * con_sock = @@ -99,24 +96,10 @@ int main (int argc, char **argv) exit (-1); } /* ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA, (Handler_Func) server_data, NULL); */ - - /* Init IRC connection */ - espik_debug_print ("<<<<<<<< DUMMMMY CODE >>>>>>>"); - - char *tmp, *tmp2; - - tmp = malloc (sizeof(char)* (strlen("NICK ") + strlen (a_infos.client->nickname))); - tmp2 = malloc (sizeof(char)* (strlen("USER localhost:") + strlen(a_infos.client->nickname)*2 + strlen (a_infos.client->realname))); + espik_con_init (a_infos); - sprintf (tmp, "NICK %s", a_infos.client->nickname); - sprintf (tmp2, "USER %s %s localhost: %s", a_infos.client->nickname, a_infos.client->nickname, a_infos.client->realname); - - espik_raw_send (tmp); - espik_raw_send (tmp2); - espik_raw_send ("JOIN #e.fr"); - - espik_debug_print ("<<<<<<<< DUMMMMY CODE >>>>>>>"); + /* Init IRC connection */ ecore_main_loop_begin (); diff --git a/src/espik.h b/src/espik.h index 6a54a37..639a791 100644 --- a/src/espik.h +++ b/src/espik.h @@ -20,6 +20,8 @@ typedef struct t_userinfo* client; } t_info; +t_info a_infos; + int del_backslash (char*); int main (int, char**); diff --git a/src/espik_net.c b/src/espik_net.c index 8970f05..460009c 100644 --- a/src/espik_net.c +++ b/src/espik_net.c @@ -16,7 +16,7 @@ typedef int (*Handler_Func) (void* data, int ev_type, void* ev); static int ret; /* For debug */ -static char connected = 0; +char connected = 0; Ecore_Con_Server* con_sock; @@ -61,6 +61,23 @@ void espik_con_init (t_info serv_info) void espik_con_up() { printf ("Connected\n"); + + espik_debug_print ("<<<<<<<< DUMMMMY CODE >>>>>>>"); + + char *tmp, *tmp2; + + tmp = malloc (sizeof(char)* (strlen("NICK ") + strlen (a_infos.client->nickname))); + tmp2 = malloc (sizeof(char)* (strlen("USER localhost:") + strlen(a_infos.client->nickname)*2 + strlen (a_infos.client->realname))); + + sprintf (tmp, "NICK %s", a_infos.client->nickname); + sprintf (tmp2, "USER %s %s localhost: %s", a_infos.client->nickname, a_infos.client->nickname, a_infos.client->realname); + + espik_raw_send (tmp); + espik_raw_send (tmp2); + espik_raw_send ("JOIN #e.fr"); + + espik_debug_print ("<<<<<<<< DUMMMMY CODE >>>>>>>"); + connected++; } @@ -71,7 +88,7 @@ void espik_con_shutdown () if (!connected) espik_debug_print ("Unable to connect to server"); - ecore_con_server_del (con_sock); + espik_debug_print ("ecore_con_server_del: %p", ecore_con_server_del (con_sock)); ecore_con_shutdown (); /* espik_debug_print ("< espik_con_shutdown"); */ -- cgit v1.2.3