mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Add carbons from barejid check
This commit is contained in:
parent
60acf6f05b
commit
4c049fb347
@ -687,6 +687,13 @@ _handle_carbons(xmpp_stanza_t * const stanza)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Jid *my_jid = jid_create(jabber_get_fulljid());
|
||||||
|
const char *const stanza_from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
||||||
|
if (g_strcmp0(my_jid->barejid, stanza_from) != 0) {
|
||||||
|
log_warning("Invalid carbon received, from: %s", stanza_from);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
char *name = xmpp_stanza_get_name(carbons);
|
char *name = xmpp_stanza_get_name(carbons);
|
||||||
if ((g_strcmp0(name, "received") == 0) || (g_strcmp0(name, "sent")) == 0) {
|
if ((g_strcmp0(name, "received") == 0) || (g_strcmp0(name, "sent")) == 0) {
|
||||||
xmpp_stanza_t *forwarded = xmpp_stanza_get_child_by_ns(carbons, STANZA_NS_FORWARD);
|
xmpp_stanza_t *forwarded = xmpp_stanza_get_child_by_ns(carbons, STANZA_NS_FORWARD);
|
||||||
|
@ -70,7 +70,7 @@ receive_carbon(void **state)
|
|||||||
prof_output_exact("unencrypted");
|
prof_output_exact("unencrypted");
|
||||||
|
|
||||||
stbbr_send(
|
stbbr_send(
|
||||||
"<message type=\"chat\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost\">"
|
"<message type=\"chat\" to=\"stabber@localhost/profanity\" from=\"stabber@localhost\">"
|
||||||
"<received xmlns=\"urn:xmpp:carbons:2\">"
|
"<received xmlns=\"urn:xmpp:carbons:2\">"
|
||||||
"<forwarded xmlns=\"urn:xmpp:forward:0\">"
|
"<forwarded xmlns=\"urn:xmpp:forward:0\">"
|
||||||
"<message id=\"prof_msg_7\" xmlns=\"jabber:client\" type=\"chat\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/mobile\">"
|
"<message id=\"prof_msg_7\" xmlns=\"jabber:client\" type=\"chat\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/mobile\">"
|
||||||
|
Loading…
Reference in New Issue
Block a user