Handle legacy delayed messages in chat rooms

This commit is contained in:
James Booth
2012-11-19 20:41:35 +00:00
parent 645d1b74d5
commit 2cdd1b3810
3 changed files with 25 additions and 22 deletions

View File

@@ -238,7 +238,8 @@ stanza_get_delay(xmpp_stanza_t * const stanza, GTimeVal *tv_stamp)
}
gboolean
stanza_is_muc_self_presence(xmpp_stanza_t * const stanza)
stanza_is_muc_self_presence(xmpp_stanza_t * const stanza,
const char * const self_jid)
{
if (stanza == NULL) {
return FALSE;
@@ -276,6 +277,19 @@ stanza_is_muc_self_presence(xmpp_stanza_t * const stanza)
x_children = xmpp_stanza_get_next(x_children);
}
// for older server that don't send status 110
while (x_children != NULL) {
if (strcmp(xmpp_stanza_get_name(x_children), STANZA_NAME_ITEM) == 0) {
char *jid = xmpp_stanza_get_attribute(x_children, STANZA_ATTR_JID);
if (jid != NULL) {
if (g_str_has_prefix(jid, self_jid)) {
return TRUE;
}
}
}
x_children = xmpp_stanza_get_next(x_children);
}
return FALSE;
}