XEP-0353: Display a notice when receiving a call
Display a notice in the console when someone tries to call us. Implement https://github.com/profanity-im/profanity/issues/1525
This commit is contained in:
@@ -93,6 +93,7 @@ static void _send_message_stanza(xmpp_stanza_t* const stanza);
|
||||
static gboolean _handle_mam(xmpp_stanza_t* const stanza);
|
||||
static void _handle_pubsub(xmpp_stanza_t* const stanza, xmpp_stanza_t* const event);
|
||||
static gboolean _handle_form(xmpp_stanza_t* const stanza);
|
||||
static gboolean _handle_jingle_message(xmpp_stanza_t* const stanza);
|
||||
|
||||
#ifdef HAVE_LIBGPGME
|
||||
static xmpp_stanza_t* _openpgp_signcrypt(xmpp_ctx_t* ctx, const char* const to, const char* const text);
|
||||
@@ -170,6 +171,11 @@ _message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* con
|
||||
} else if (type == NULL || g_strcmp0(type, STANZA_TYPE_CHAT) == 0 || g_strcmp0(type, STANZA_TYPE_NORMAL) == 0) {
|
||||
// type: chat, normal (==NULL)
|
||||
|
||||
// XEP-0353: Jingle Message Initiation
|
||||
if (_handle_jingle_message(stanza)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// XEP-0045: Multi-User Chat 8.6 Voice Requests
|
||||
if (_handle_form(stanza)) {
|
||||
return 1;
|
||||
@@ -1664,3 +1670,20 @@ message_request_voice(const char* const roomjid)
|
||||
_send_message_stanza(stanza);
|
||||
xmpp_stanza_release(stanza);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_handle_jingle_message(xmpp_stanza_t* const stanza)
|
||||
{
|
||||
xmpp_stanza_t* propose = xmpp_stanza_get_child_by_name_and_ns(stanza, STANZA_NAME_PROPOSE, STANZA_NS_JINGLE_MESSAGE);
|
||||
|
||||
if (propose) {
|
||||
xmpp_stanza_t* description = xmpp_stanza_get_child_by_ns(propose, STANZA_NS_JINGLE_RTP);
|
||||
if (description) {
|
||||
const char* const from = xmpp_stanza_get_from(stanza);
|
||||
cons_show("Ring ring: %s is trying to call you", from);
|
||||
cons_alert(NULL);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user