]> hackdaworld.org Git - my-code/ivac.git/commitdiff
some more monitor calls, fixed display when input event bug, todo: use gtk! :)
authorhackbard <hackbard>
Wed, 12 May 2004 14:21:38 +0000 (14:21 +0000)
committerhackbard <hackbard>
Wed, 12 May 2004 14:21:38 +0000 (14:21 +0000)
src/ivac.c

index 3aad5998c56104ef3a7a598d26ba7c54d61ab3e7..56a687fb6603443236966a3d32763c68a1d07abf 100644 (file)
@@ -22,6 +22,8 @@
  */
 
 // #define USE_NCURSES
+/* dont care about ncurses .. go for gtk(2)! */
+#define USE_GTK
 
 #include "ivac.h"
 
@@ -180,6 +182,7 @@ int ivac_send_quit(int channel,t_ivac *ivac) {
 int ivac_receive_info(int channel,t_ivac *ivac) {
 
   char data[SEND_N_MAX];
+  char c_str[IVAC_CONSOLE_STRING_LEN];
   int count,length;
 
   count=0;
@@ -208,14 +211,19 @@ int ivac_receive_info(int channel,t_ivac *ivac) {
         break;
       case IVAC_SEND_QUIT:
         if(!(strncmp(data+count+2,"quit",data[1])))
+          sprintf(c_str,"channel %02d: connection closed by remote host",
+                  channel);
           event_math(ivac->net.connection[channel].fd,&(ivac->event),
                      READ,REMOVE);
           network_close(&(ivac->net),channel);
           memset(&(ivac->challenger[channel]),0,sizeof(t_challenger));
+          ivac_add_to_monitor(ivac,c_str);
           count+=6;
+          break;
       default:
-        printf("[ivac] ivac_receive_info, unknown character: (%c,%02x\n",
+        sprintf(c_str,"ivac_receive_info, unknown character: 0x%02x\n",
                data[count]);
+        ivac_add_to_monitor(ivac,c_str);
         return ERROR;
         break;
     }
@@ -254,9 +262,10 @@ int ivac_event_cb(t_event *event,void *ptr) {
   for(channel=0;channel<MAX_CONNECTIONS;channel++) {
     if(ivac->net.connection[channel].status&C_ESTABL) {
       /* remote is sending info */
-      if(FD_ISSET(ivac->net.connection[channel].fd,&(event->rfds)))
+      if(FD_ISSET(ivac->net.connection[channel].fd,&(event->rfds))) {
         ivac_receive_info(channel,ivac);
         ivac_display_content(ivac);
+      }
     }
   }