aboutsummaryrefslogtreecommitdiff
path: root/src/espik_common_handler.c
diff options
context:
space:
mode:
authorbeber <beber>2005-07-24 22:26:09 +0000
committerbeber <beber>2005-07-24 22:26:09 +0000
commit18fc944ae33b811e15bf028a35977f2e9c7bd6b5 (patch)
tree820b3f95655a67a8ee76b3a76e720e1eb852d4e2 /src/espik_common_handler.c
parentOops wrong file name (diff)
downloadespik-18fc944ae33b811e15bf028a35977f2e9c7bd6b5.tar.xz
indent
Diffstat (limited to 'src/espik_common_handler.c')
-rw-r--r--src/espik_common_handler.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/espik_common_handler.c b/src/espik_common_handler.c
new file mode 100644
index 0000000..2c29322
--- /dev/null
+++ b/src/espik_common_handler.c
@@ -0,0 +1,71 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <Ecore.h>
+#include <Ecore_Con.h>
+
+#include "global.h"
+#include "espik_common_handler.h"
+#include "espik_irc.h"
+#include "espik_net.h"
+#include "espik.h"
+#include "error.h"
+
+int server_data (void *data __UNUSED__, int ev_type __UNUSED__, Ecore_Con_Event_Server_Data * ev)
+{
+ printf ("%s\n", (char *)ev->data);
+
+ return (0);
+}
+
+int kb_get (void *data __UNUSED__, Ecore_Fd_Handler * fd_handler)
+{
+ char *kb;
+ char *tmp;
+ int count;
+
+ kb = malloc (sizeof (char) * 200);
+ chk_malloc (kb);
+
+ do
+ {
+ memset (kb, 0, 200);
+ count = read (ecore_main_fd_handler_fd_get (fd_handler), kb, 198);
+
+ if (count > 1)
+ {
+ del_backslash (kb);
+ tmp = irc_send (kb);
+
+ if (tmp)
+ {
+ espik_raw_send (tmp);
+ free (tmp);
+ }
+ }
+ }
+ while (count >= 198);
+
+ if (count == -1)
+ perror ("read");
+
+ if (count == 0)
+ {
+ tmp = irc_quit ("", "^D pressed");
+ printf ("kb_get:\ntmp: %s\n", tmp);
+ espik_raw_send (tmp);
+ printf ("AFTER espik_raw_send\n");
+
+ // irc_disconnect();
+ espik_con_shutdown ();
+
+ ecore_main_loop_quit ();
+
+ free (tmp);
+ return (0);
+ }
+
+ return (1);
+}