Don't render (all) delayed messages as MUC history
Double-check that a <delay/> tag on a groupchat message was actually added by the MUC service (rather than the sending client) before assuming it was received from the MUC history. Fixes #1173.
This commit is contained in:
@@ -1173,6 +1173,12 @@ stanza_create_caps_sha1_from_query(xmpp_stanza_t *const query)
|
||||
|
||||
GDateTime*
|
||||
stanza_get_delay(xmpp_stanza_t *const stanza)
|
||||
{
|
||||
return stanza_get_delay_from(stanza, NULL);
|
||||
}
|
||||
|
||||
GDateTime*
|
||||
stanza_get_delay_from(xmpp_stanza_t *const stanza, gchar **from)
|
||||
{
|
||||
GTimeVal utc_stamp;
|
||||
// first check for XEP-0203 delayed delivery
|
||||
@@ -1185,6 +1191,9 @@ stanza_get_delay(xmpp_stanza_t *const stanza)
|
||||
GDateTime *utc_datetime = g_date_time_new_from_timeval_utc(&utc_stamp);
|
||||
GDateTime *local_datetime = g_date_time_to_local(utc_datetime);
|
||||
g_date_time_unref(utc_datetime);
|
||||
if (from) {
|
||||
*from = g_strdup(xmpp_stanza_get_attribute(delay, STANZA_ATTR_FROM));
|
||||
}
|
||||
return local_datetime;
|
||||
}
|
||||
}
|
||||
@@ -1201,11 +1210,17 @@ stanza_get_delay(xmpp_stanza_t *const stanza)
|
||||
GDateTime *utc_datetime = g_date_time_new_from_timeval_utc(&utc_stamp);
|
||||
GDateTime *local_datetime = g_date_time_to_local(utc_datetime);
|
||||
g_date_time_unref(utc_datetime);
|
||||
if (from) {
|
||||
*from = g_strdup(xmpp_stanza_get_attribute(x, STANZA_ATTR_FROM));
|
||||
}
|
||||
return local_datetime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (from) {
|
||||
*from = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user