diff options
author | Timo Sirainen <cras@irssi.org> | 2002-03-10 14:55:46 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-03-10 14:55:46 +0000 |
commit | ca234bdf5e88778e4cf569d3bb6d82b26c44163d (patch) | |
tree | b5af283c08724b8f96e186ab997c08f838f623f1 /src/fe-common/core/formats.c | |
parent | 418678bc95ddf388368978ebddc0776439c788f0 (diff) | |
download | irssi-ca234bdf5e88778e4cf569d3bb6d82b26c44163d.zip |
*** empty log message ***
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2553 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/core/formats.c')
-rw-r--r-- | src/fe-common/core/formats.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index d70bcc45..b91bc0ee 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -549,6 +549,31 @@ char *format_add_linestart(const char *text, const char *linestart) return ret; } +char *format_add_lineend(const char *text, const char *linestart) +{ + GString *str; + char *ret; + + if (linestart == NULL) + return g_strdup(text); + + if (strchr(text, '\n') == NULL) + return g_strconcat(text, linestart, NULL); + + str = g_string_new(NULL); + while (*text != '\0') { + if (*text == '\n') + g_string_append(str, linestart); + g_string_append_c(str, *text); + text++; + } + g_string_append(str, linestart); + + ret = str->str; + g_string_free(str, FALSE); + return ret; +} + #define LINE_START_IRSSI_LEVEL \ (MSGLEVEL_CLIENTERROR | MSGLEVEL_CLIENTNOTICE) |