static void logs_window_new(window_t *w) { const char *uid; if (!w->target || !w->session || w->id == WINDOW_CONTACTS_ID) /* XXX w->id in WINDOW_RESERVED_ID ??? */ return; uid = get_uid_any(w->session, w->target); /* XXX, do we really want/need to create log struct with invalid uid? XXX */ logs_log_new(NULL, session_uid_get(w->session), uid ? uid : w->target); }
static void logs_window_new(window_t *w) { const char *uid; if (!w->target || !w->session || w->id == 1000) return; uid = get_uid_any(w->session, w->target); /* XXX, do we really want/need to create log struct with invalid uid? XXX */ logs_log_new(NULL, session_uid_get(w->session), uid ? uid : w->target); }
static logs_log_t *logs_log_new(const char *session, const char *target, gboolean raw) { logs_log_t *ll; log_format_t format; char *uid, *tmp; if (LOG_FORMAT_NONE == (format = raw ? LOG_FORMAT_RAW : logs_log_format(session_find(session)))) return NULL; if (!(uid = g_strdup(get_uid_any(session_find(session), target)))) uid = g_strdup(target); if ((tmp = xstrchr(uid, '/'))) *tmp = '\0'; // strip resource ll = logs_log_find(session, uid, raw); if (ll) { g_free(uid); return ll; } // Create new ll = xmalloc(sizeof(logs_log_t)); ll->session = g_strdup(session); ll->uid = uid; ll->format = format; ll->fname = logs_prepare_fname(ll); g_ptr_array_add(logs_logs, ll); if (ll->format == LOG_FORMAT_IRSSI && xstrlen(IRSSI_LOG_EKG2_OPENED)) { logs_open_file(ll); logs_irssi_sysmsg(ll, prepare_timestamp_format(IRSSI_LOG_EKG2_OPENED, time(NULL))); } debug("[logs] log_new s=%s uid=%s ff=%d logs_log_t %x\n", __(session), __(uid), ll->format, ll); return ll; }