aboutsummaryrefslogtreecommitdiff
path: root/src/espik.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/espik.c')
-rw-r--r--src/espik.c150
1 files changed, 75 insertions, 75 deletions
diff --git a/src/espik.c b/src/espik.c
index 6b49e7b..7f6ef72 100644
--- a/src/espik.c
+++ b/src/espik.c
@@ -6,9 +6,9 @@
/* EFL Stuff */
#include <Ecore.h>
-#include <Ecore_Config.h> /* Configuration lib */
-/*#include <Ecore_Con.h> */ /* Socket lib */
-#include <Ecore_Data.h> /* List */
+#include <Ecore_Config.h> /* Configuration lib */
+/*#include <Ecore_Con.h> */ /* Socket lib */
+#include <Ecore_Data.h> /* List */
/* Espik Stuff */
#include "espik_global.h"
@@ -17,107 +17,107 @@
#include "espik_net.h"
#include "espik.h"
-typedef int (*Handler_Func) (void *data, int ev_type, void *ev);
+typedef int (*Handler_Func) (void *data, int ev_type, void *ev);
/* typedef int (*Handler_Fd_Func) (void *data, Ecore_Fd_Handler * fd_handler); */
static void espik_destroy_ptr (void *ptr)
{
- if (ptr)
- {
- printf ("Freeing data...");
- free (ptr);
- ptr = NULL;
- }
+ if (ptr)
+ {
+ printf ("Freeing data %p ...", ptr_list);
+ free (ptr);
+ ptr = NULL;
+ }
}
static void espik_init (void)
{
- printf ("Welcome to %s-%s\n", APPS_NAME, ESPIK_VERSION);
- ptr_list = ecore_list_new();
-
+ printf ("Welcome to %s-%s\n", APPS_NAME, ESPIK_VERSION);
+ ptr_list = ecore_list_new();
+
if (!ecore_init ())
- {
- printf ("Cannot init ecore; %d\n", 1);
- exit (-1);
- }
+ {
+ printf ("Cannot init ecore; %d\n", 1);
+ exit (-1);
+ }
- ecore_list_set_free_cb (ptr_list, espik_destroy_ptr);
+ ecore_list_set_free_cb (ptr_list, espik_destroy_ptr);
}
void espik_free (void *ptr)
{
- ecore_list_append (ptr_list, ptr);
+ ecore_list_append (ptr_list, ptr);
}
void espik_shutdown (void)
{
- ecore_main_loop_quit();
+ ecore_main_loop_quit();
}
/* Use to replace EOL ('\n') with NULL ('\0') */
int del_backslash (char *msg)
{
- int i, count;
-
- for (i = 0, count = 0 ; msg[i] ; i++)
- {
- if (msg[i] == '\n')
- {
- msg[i] = '\0';
- count++;
- }
- }
-
- return (count);
+ int i, count;
+
+ for (i = 0, count = 0 ; msg[i] ; i++)
+ {
+ if (msg[i] == '\n')
+ {
+ msg[i] = '\0';
+ count++;
+ }
+ }
+
+ return (count);
}
int main (int argc, char **argv)
{
- Ecore_Fd_Handler *fd_kb;
-
- espik_init ();
- espik_config_init ();
-
- if (argc < 3)
- {
- printf ("Loading from conf ...\n");
- espik_config_get (&a_infos);
- }
- else
- {
- printf ("Connecting to %s:%s\n", argv[1], argv[2]);
- a_infos.client = espik_user_sysinfo_get ();
- a_infos.server = espik_server_config_set (argv[1],
- (unsigned short)atoi (argv[2]));
- }
-
- espik_config_set (a_infos);
-
- printf ("host: %s\n", a_infos.server->host);
- printf ("port: %hd\n", a_infos.server->port);
- printf ("nick: %s\n", a_infos.client->nickname);
- printf ("user: %s\n", a_infos.client->username);
- printf ("real: %s\n", a_infos.client->realname);
-
- /* Handler Keyboard */
- fd_kb = ecore_main_fd_handler_add (STDIN_FILENO, ECORE_FD_READ, kb_get,
- NULL, NULL, NULL);
- espik_free (fd_kb);
- if (!fd_kb)
- {
- printf ("Cannot ecore_main_fd_handler_add\n");
- exit (-1);
- }
-
+ Ecore_Fd_Handler *fd_kb;
+
+ espik_init ();
+ espik_config_init ();
+
+ if (argc < 3)
+ {
+ printf ("Loading from conf ...\n");
+ espik_config_get (&a_infos);
+ }
+ else
+ {
+ printf ("Connecting to %s:%s\n", argv[1], argv[2]);
+ a_infos.client = espik_user_sysinfo_get ();
+ a_infos.server = espik_server_config_set (argv[1],
+ (unsigned short)atoi (argv[2]));
+ }
+
+ espik_config_set (a_infos);
+
+ printf ("host: %s\n", a_infos.server->host);
+ printf ("port: %hd\n", a_infos.server->port);
+ printf ("nick: %s\n", a_infos.client->nickname);
+ printf ("user: %s\n", a_infos.client->username);
+ printf ("real: %s\n", a_infos.client->realname);
+
+ /* Handler Keyboard */
+ fd_kb = ecore_main_fd_handler_add (STDIN_FILENO, ECORE_FD_READ, kb_get,
+ NULL, NULL, NULL);
+ espik_free (fd_kb);
+ if (!fd_kb)
+ {
+ printf ("Cannot ecore_main_fd_handler_add\n");
+ exit (-1);
+ }
+
espik_con_init (a_infos);
- ecore_main_loop_begin ();
+ ecore_main_loop_begin ();
- espik_shutdown ();
- espik_config_shutdown (a_infos);
-
- ecore_shutdown ();
- ecore_list_destroy (ptr_list);
+ espik_shutdown ();
+ espik_config_shutdown (a_infos);
+
+ ecore_shutdown ();
+//ecore_list_destroy (ptr_list);
- return (0);
+ return (0);
}