1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into clear

This commit is contained in:
James Booth 2017-01-23 22:35:37 +00:00
commit 4207873c8a
3 changed files with 15 additions and 4 deletions

View File

@ -298,11 +298,15 @@ ui_contact_typing(const char *const barejid, const char *const resource)
if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_TYPING_CURRENT)) ) { if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_TYPING_CURRENT)) ) {
PContact contact = roster_get_contact(barejid); PContact contact = roster_get_contact(barejid);
char const *display_usr = NULL; char const *display_usr = NULL;
if (contact) {
if (p_contact_name(contact)) { if (p_contact_name(contact)) {
display_usr = p_contact_name(contact); display_usr = p_contact_name(contact);
} else { } else {
display_usr = barejid; display_usr = barejid;
} }
} else {
display_usr = barejid;
}
notify_typing(display_usr); notify_typing(display_usr);
} }
} }

View File

@ -714,6 +714,14 @@ _handle_carbons(xmpp_stanza_t *const stanza)
return TRUE; return TRUE;
} }
Jid *my_jid = jid_create(connection_get_fulljid());
const char *const stanza_from = xmpp_stanza_get_from(stanza);
Jid *msg_jid = jid_create(stanza_from);
if (g_strcmp0(my_jid->barejid, msg_jid->barejid) != 0) {
log_warning("Invalid carbon received, from: %s", stanza_from);
return TRUE;
}
const gchar *to = xmpp_stanza_get_to(message); const gchar *to = xmpp_stanza_get_to(message);
const gchar *from = xmpp_stanza_get_from(message); const gchar *from = xmpp_stanza_get_from(message);
@ -722,7 +730,6 @@ _handle_carbons(xmpp_stanza_t *const stanza)
Jid *jid_from = jid_create(from); Jid *jid_from = jid_create(from);
Jid *jid_to = jid_create(to); Jid *jid_to = jid_create(to);
Jid *my_jid = jid_create(connection_get_fulljid());
// check for pgp encrypted message // check for pgp encrypted message
char *enc_message = NULL; char *enc_message = NULL;

View File

@ -70,7 +70,7 @@ receive_carbon(void **state)
assert_true(prof_output_exact("unencrypted")); assert_true(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'>"