aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBertrand Jacquin (Beber) <beber@setibzh.com>2006-01-22 22:59:59 +0100
committerBertrand Jacquin (Beber) <beber@setibzh.com>2006-01-22 22:59:59 +0100
commit71dbdcf13a2297536400d204a4c2eae70fde26ca (patch)
treec2e04c40f351d3fd9dc0a70307982fa1da4c042d /src
parentComment (diff)
downloadespik-71dbdcf13a2297536400d204a4c2eae70fde26ca.tar.xz
freeeee
But that fuck
Diffstat (limited to 'src')
-rw-r--r--src/espik.c19
-rw-r--r--src/espik_config.c22
-rw-r--r--src/espik_config.h2
-rw-r--r--src/espik_net.c24
4 files changed, 42 insertions, 25 deletions
diff --git a/src/espik.c b/src/espik.c
index 45b4dd7..0cee0c6 100644
--- a/src/espik.c
+++ b/src/espik.c
@@ -57,6 +57,12 @@ int main (int argc, char **argv)
#ifdef _ESPIK_DEBUG_
espik_debug_init();
#endif
+ if (!ecore_init ())
+ {
+ printf ("Cannot init ecore; %d\n", 1);
+ exit (-1);
+ }
+
espik_config_init ();
if (argc < 3)
@@ -80,13 +86,8 @@ int main (int argc, char **argv)
printf ("user: %s\n", a_infos.client->username);
printf ("real: %s\n", a_infos.client->realname);
-#if 0
- if (!ecore_init ())
- {
- printf ("Cannot init ecore; %d\n", 1);
- exit (-1);
- }
+#if 0
con_sock =
ecore_con_server_connect (ECORE_CON_REMOTE_SYSTEM,
a_infos.server->host,
@@ -118,6 +119,8 @@ int main (int argc, char **argv)
ecore_main_loop_begin ();
+ ecore_main_fd_handler_del (fd_kb);
+
/*
ecore_con_server_del (con_sock);
*/
@@ -135,13 +138,13 @@ int main (int argc, char **argv)
espik_debug_print ("end");
- espik_config_shutdown (&a_infos);
+ espik_config_shutdown (a_infos);
/*
espik_con_shutdown ();
*/
- ecore_main_loop_quit ();
+// ecore_main_loop_quit ();
ecore_shutdown ();
//espik_leave();
diff --git a/src/espik_config.c b/src/espik_config.c
index 6d6fc67..0cbc0d3 100644
--- a/src/espik_config.c
+++ b/src/espik_config.c
@@ -40,17 +40,15 @@ t_userinfo* espik_user_sysinfo_get ()
//u_info->nickname = pw->pw_name;
u_info->nickname = strdup ("beber_espik_test");
- u_info->username = pw->pw_name;
+ u_info->username = strdup (pw->pw_name);
if (! (pw->pw_gecos[0]) )
u_info->realname = strdup ("espik user");
else
- u_info->realname = pw->pw_gecos;
+ u_info->realname = strdup (pw->pw_gecos);
- /* FIXME: segv
+ /* FIXME: segv */
free (pw);
- */
-
espik_leave();
return (u_info);
@@ -106,15 +104,15 @@ void espik_config_init ()
espik_leave();
}
-void espik_config_shutdown (t_info *s_info)
+void espik_config_shutdown (t_info s_info)
{
- free (s_info->server->host);
+ free (s_info.server->host);
// free (s_info->server->port);
- free (s_info->server);
- free (s_info->client->nickname);
- free (s_info->client->username);
- free (s_info->client->realname);
- free (s_info->client);
+ free (s_info.server);
+ free (s_info.client->nickname);
+ free (s_info.client->username);
+ free (s_info.client->realname);
+ free (s_info.client);
// free (s_info);
ecore_config_save();
diff --git a/src/espik_config.h b/src/espik_config.h
index e454cfd..f9bb213 100644
--- a/src/espik_config.h
+++ b/src/espik_config.h
@@ -10,7 +10,7 @@ void espik_config_default_set ();
void espik_config_init ();
void espik_config_get (t_info*);
void espik_config_set (t_info);
-void espik_config_shutdown (t_info *s_info);
+void espik_config_shutdown (t_info);
#define ESPIK_CONFIG_VERSION 1
diff --git a/src/espik_net.c b/src/espik_net.c
index 5fe8944..679ee04 100644
--- a/src/espik_net.c
+++ b/src/espik_net.c
@@ -21,6 +21,17 @@ char connected = 0;
Ecore_Con_Server* con_sock;
+typedef struct
+{
+ Ecore_Event_Handler* data;
+ Ecore_Event_Handler* up;
+ Ecore_Event_Handler* down;
+
+} espik_con_handler_list;
+
+
+espik_con_handler_list handler_list;
+
void espik_con_init (t_info serv_info)
{
int nb_launch;
@@ -44,7 +55,7 @@ void espik_con_init (t_info serv_info)
exit (-1);
}
- if (! (ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA,
+ if (! (handler_list.data = ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA,
(Handler_Func) server_data, NULL)))
{
espik_debug_print ("ecore_event_handler_add "
@@ -52,7 +63,7 @@ void espik_con_init (t_info serv_info)
exit (-1);
}
- if (! (ecore_event_handler_add (ECORE_CON_EVENT_SERVER_ADD,
+ if (! (handler_list.up = ecore_event_handler_add (ECORE_CON_EVENT_SERVER_ADD,
(Handler_Func) espik_con_up, NULL)))
{
espik_debug_print ("ecore_event_handler_add "
@@ -60,7 +71,7 @@ void espik_con_init (t_info serv_info)
exit (-1);
}
- if (! (ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DEL,
+ if (! (handler_list.down = ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DEL,
(Handler_Func) espik_con_shutdown, NULL)))
{
espik_debug_print ("ecore_event_handler_add "
@@ -122,10 +133,16 @@ void espik_con_shutdown ()
espik_debug_print ("ecore_con_server_del: %p",
ecore_con_server_del (con_sock));
+
ecore_con_shutdown ();
+ ecore_event_handler_del (handler_list.data);
+ ecore_event_handler_del (handler_list.up);
+ ecore_event_handler_del (handler_list.down);
+
ecore_main_loop_quit ();
free (server_dns);
+
espik_leave();
}
@@ -150,7 +167,6 @@ void espik_raw_send (const char *msg)
printf ("out[len-1]: 0x%X\n", out[len - 1]);
*/
-
int i;
for (i = 0 ; buf.buf[i] != 0 ; i++)
{