First step towards message tags extension support

(see http://ircv3.atheme.org/specification/message-tags-3.2).

In particular this commit implements a (very) dummy implementation
sketch of the server-time extension
(see http://ircv3.atheme.org/specification/message-tags-3.2 and #499).
This commit is contained in:
Diogo Sousa
2013-06-22 00:13:36 +01:00
parent ac5771377e
commit 94186f7888
7 changed files with 136 additions and 32 deletions

View File

@@ -865,8 +865,8 @@ text_validate (char **text, int *len)
return utf;
}
void
PrintText (session *sess, char *text)
static void
PrintTextTimeStamp (session *sess, char *text, time_t timestamp)
{
char *conv;
@@ -890,12 +890,18 @@ PrintText (session *sess, char *text)
log_write (sess, text);
scrollback_save (sess, text);
fe_print_text (sess, text, 0);
fe_print_text (sess, text, timestamp);
if (conv)
g_free (conv);
}
void
PrintText (session *sess, char *text)
{
PrintTextTimeStamp (sess, text, 0);
}
void
PrintTextf (session *sess, char *format, ...)
{
@@ -1836,12 +1842,13 @@ format_event (session *sess, int index, char **args, char *o, int sizeofo, unsig
}
static void
display_event (session *sess, int event, char **args, unsigned int stripcolor_args)
display_event (session *sess, int event, char **args,
unsigned int stripcolor_args, time_t timestamp)
{
char o[4096];
format_event (sess, event, args, o, sizeof (o), stripcolor_args);
if (o[0])
PrintText (sess, o);
PrintTextTimeStamp (sess, o, timestamp);
}
int
@@ -2042,7 +2049,8 @@ text_color_of (char *name)
/* called by EMIT_SIGNAL macro */
void
text_emit (int index, session *sess, char *a, char *b, char *c, char *d)
text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
time_t timestamp)
{
char *word[PDIWORDS];
int i;
@@ -2120,7 +2128,7 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d)
}
sound_play_event (index);
display_event (sess, index, word, stripcolor_args);
display_event (sess, index, word, stripcolor_args, timestamp);
}
char *
@@ -2143,7 +2151,7 @@ text_emit_by_name (char *name, session *sess, char *a, char *b, char *c, char *d
i = pevent_find (name, &i);
if (i >= 0)
{
text_emit (i, sess, a, b, c, d);
text_emit (i, sess, a, b, c, d, 0);
return 1;
}