mcabber/src/fifo.c
changeset 1427 a8eb9aba2ed2
parent 1426 a64778f5f26b
child 1526 eefa0ae248d8
equal deleted inserted replaced
1426:a64778f5f26b 1427:a8eb9aba2ed2
    30 #include <fcntl.h>
    30 #include <fcntl.h>
    31 
    31 
    32 #include "commands.h"
    32 #include "commands.h"
    33 #include "logprint.h"
    33 #include "logprint.h"
    34 #include "utils.h"
    34 #include "utils.h"
       
    35 #include "settings.h"
    35 
    36 
    36 #include "hbuf.h"   // For HBB_BLOCKSIZE
    37 #include "hbuf.h"   // For HBB_BLOCKSIZE
    37 
    38 
    38 static FILE *sfd;
    39 static FILE *sfd;
    39 static char *fifo_name;
    40 static char *fifo_name;
   141     return;
   142     return;
   142   }
   143   }
   143 
   144 
   144   getbuf = fgets(buf, HBB_BLOCKSIZE, sfd);
   145   getbuf = fgets(buf, HBB_BLOCKSIZE, sfd);
   145   if (getbuf) {
   146   if (getbuf) {
       
   147     guint logflag;
   146     char *eol = buf;
   148     char *eol = buf;
   147 
   149 
   148     // Strip trailing newlines
   150     // Strip trailing newlines
   149     for ( ; *eol ; eol++)
   151     for ( ; *eol ; eol++)
   150       ;
   152       ;
   151     if (eol > buf)
   153     if (eol > buf)
   152       eol--;
   154       eol--;
   153     while (eol > buf && *eol == '\n')
   155     while (eol > buf && *eol == '\n')
   154       *eol-- = 0;
   156       *eol-- = 0;
   155 
   157 
   156     scr_LogPrint(LPRINT_LOGNORM, "Executing FIFO command: %s", buf);
   158     if (settings_opt_get_int("fifo_hide_commands"))
       
   159       logflag = LPRINT_LOG;
       
   160     else
       
   161       logflag = LPRINT_LOGNORM;
       
   162     scr_LogPrint(logflag, "Executing FIFO command: %s", buf);
   157     if (process_command(buf, TRUE) == 255)
   163     if (process_command(buf, TRUE) == 255)
   158       mcabber_set_terminate_ui();
   164       mcabber_set_terminate_ui();
   159   } else {
   165   } else {
   160     if (feof(sfd))
   166     if (feof(sfd))
   161       fifo_init(NULL);  // Reopen the FIFO on EOF
   167       fifo_init(NULL);  // Reopen the FIFO on EOF