mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-12 16:50:19 +00:00
Implement generic support for IRCv3 standard replies. (#2589)
https://ircv3.net/specs/extensions/standard-replies Co-authored-by: Patrick <tingping@tingping.se>
This commit is contained in:
@@ -460,6 +460,18 @@ channel_date (session *sess, char *chan, char *timestr,
|
||||
tags_data->timestamp);
|
||||
}
|
||||
|
||||
static int
|
||||
trailing_index(const char *word_eol[])
|
||||
{
|
||||
int param_index;
|
||||
for (param_index = 3; param_index < PDIWORDS; ++param_index)
|
||||
{
|
||||
if (word_eol[param_index][0] == ':')
|
||||
break;
|
||||
}
|
||||
return param_index;
|
||||
}
|
||||
|
||||
static void
|
||||
process_numeric (session * sess, int n,
|
||||
char *word[], char *word_eol[], char *text,
|
||||
@@ -1139,6 +1151,39 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
|
||||
(word_eol[3][0] == ':') ? word_eol[3] + 1 : NULL,
|
||||
tags_data);
|
||||
return;
|
||||
|
||||
case WORDL('F','A','I','L'):
|
||||
text = STRIP_COLON(word, word_eol, trailing_index(word_eol));
|
||||
if (g_strcmp0(word[3], "*") == 0)
|
||||
{
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_FAIL, sess, word[4], text, NULL, NULL, NULL, tags_data->timestamp);
|
||||
} else
|
||||
{
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_FAILCMD, sess, word[3], word[4], text, NULL, NULL, tags_data->timestamp);
|
||||
}
|
||||
return;
|
||||
|
||||
case WORDL('W','A','R','N'):
|
||||
text = STRIP_COLON(word, word_eol, trailing_index(word_eol));
|
||||
if (g_strcmp0(word[3], "*") == 0)
|
||||
{
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_WARN, sess, word[4], text, NULL, NULL, NULL, tags_data->timestamp);
|
||||
} else
|
||||
{
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_WARNCMD, sess, word[3], word[4], text, NULL, NULL, tags_data->timestamp);
|
||||
}
|
||||
return;
|
||||
|
||||
case WORDL('N','O','T','E'):
|
||||
text = STRIP_COLON(word, word_eol, trailing_index(word_eol));
|
||||
if (g_strcmp0(word[3], "*") == 0)
|
||||
{
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTE, sess, word[4], text, NULL, NULL, NULL, tags_data->timestamp);
|
||||
} else
|
||||
{
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_NOTECMD, sess, word[3], word[4], text, NULL, NULL, tags_data->timestamp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
goto garbage;
|
||||
|
||||
Reference in New Issue
Block a user