degesch: prepare for printing to buffers

This commit is contained in:
Přemysl Eric Janouch 2015-04-17 22:10:43 +02:00
parent 5b9dadcc58
commit f9125c38c0
1 changed files with 7 additions and 2 deletions

View File

@ -789,9 +789,9 @@ buffer_send (struct app_context *ctx, struct buffer *buffer,
line->type = type;
line->flags = flags;
line->when = time (NULL);
line->who = xstrdup (origin);
line->who = origin ? xstrdup (origin) : NULL;
line->object = str_steal (&text);
line->reason = xstrdup (reason);
line->reason = reason ? xstrdup (reason) : NULL;
LIST_APPEND_WITH_TAIL (buffer->lines, buffer->lines_tail, line);
buffer->lines_count++;
@ -804,6 +804,11 @@ buffer_send (struct app_context *ctx, struct buffer *buffer,
buffer_line_display (ctx, line);
}
#define buffer_send_status(ctx, buffer, ...) \
buffer_send (ctx, buffer, BUFFER_LINE_STATUS, 0, NULL, NULL, __VA_ARGS__)
#define buffer_send_error(ctx, buffer, ...) \
buffer_send (ctx, buffer, BUFFER_LINE_ERROR, 0, NULL, NULL, __VA_ARGS__)
static struct buffer *
buffer_by_name (struct app_context *ctx, const char *name)
{