mcabber/src/hooks.c
changeset 374 bd5638c21834
parent 364 33b8e801ffa6
child 378 2e6c7b1440d1
equal deleted inserted replaced
373:af2f8ddf6a1b 374:bd5638c21834
    43     new_guy = TRUE;
    43     new_guy = TRUE;
    44   }
    44   }
    45 
    45 
    46   if (type && !strcmp(type, "error")) {
    46   if (type && !strcmp(type, "error")) {
    47     message_flags = HBB_PREFIX_ERR | HBB_PREFIX_IN;
    47     message_flags = HBB_PREFIX_ERR | HBB_PREFIX_IN;
    48     scr_LogPrint("Error message received from <%s>", jid);
    48     scr_LogPrint(LPRINT_LOGNORM, "Error message received from <%s>", jid);
    49   } else
    49   } else
    50     message_flags = 0;
    50     message_flags = 0;
    51 
    51 
    52   // Note: the hlog_write should not be called first, because in some
    52   // Note: the hlog_write should not be called first, because in some
    53   // cases scr_WriteIncomingMessage() will load the history and we'd
    53   // cases scr_WriteIncomingMessage() will load the history and we'd
    77 }
    77 }
    78 
    78 
    79 inline void hk_statuschange(const char *jid, time_t timestamp, 
    79 inline void hk_statuschange(const char *jid, time_t timestamp, 
    80         enum imstatus status, const char *status_msg)
    80         enum imstatus status, const char *status_msg)
    81 {
    81 {
    82   scr_LogPrint("Buddy status has changed: [%c>%c] <%s> %s",
    82   scr_LogPrint(LPRINT_LOGNORM, "Buddy status has changed: [%c>%c] <%s> %s",
    83           imstatus2char[roster_getstatus(jid)], imstatus2char[status], jid,
    83           imstatus2char[roster_getstatus(jid)], imstatus2char[status], jid,
    84           ((status_msg) ? status_msg : ""));
    84           ((status_msg) ? status_msg : ""));
    85   roster_setstatus(jid, status, status_msg);
    85   roster_setstatus(jid, status, status_msg);
    86   buddylist_build();
    86   buddylist_build();
    87   scr_DrawRoster();
    87   scr_DrawRoster();
    94         enum imstatus old_status, enum imstatus new_status, const char *msg)
    94         enum imstatus old_status, enum imstatus new_status, const char *msg)
    95 {
    95 {
    96   if (!msg && (old_status == new_status))
    96   if (!msg && (old_status == new_status))
    97     return;
    97     return;
    98 
    98 
    99   scr_LogPrint("Your status has changed:  [%c>%c] %s",
    99   scr_LogPrint(LPRINT_LOGNORM, "Your status has changed:  [%c>%c] %s",
   100           imstatus2char[old_status], imstatus2char[new_status],
   100           imstatus2char[old_status], imstatus2char[new_status],
   101           ((msg) ? msg : ""));
   101           ((msg) ? msg : ""));
   102   //hlog_write_status(NULL, 0, status);
   102   //hlog_write_status(NULL, 0, status);
   103 }
   103 }
   104 
   104 
   154   }
   154   }
   155 
   155 
   156   if (!arg_type || !arg_info) return;
   156   if (!arg_type || !arg_info) return;
   157 
   157 
   158   if ((pid=fork()) == -1) {
   158   if ((pid=fork()) == -1) {
   159     scr_LogPrint("Fork error, cannot launch external command.");
   159     scr_LogPrint(LPRINT_LOGNORM, "Fork error, cannot launch external command.");
   160     return;
   160     return;
   161   }
   161   }
   162 
   162 
   163   if (pid == 0) { // child
   163   if (pid == 0) { // child
   164     if (execl(extcmd, extcmd, arg_type, arg_info, jid, arg_data) == -1) {
   164     if (execl(extcmd, extcmd, arg_type, arg_info, jid, arg_data) == -1) {
   165       // ut_WriteLog("Cannot execute external command.\n");
   165       // scr_LogPrint(LPRINT_LOGNORM, "Cannot execute external command.");
   166       exit(1);
   166       exit(1);
   167     }
   167     }
   168   }
   168   }
   169 }
   169 }
   170 
   170