mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
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:
parent
86aec9d068
commit
46cd09cce4
@ -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;
|
||||
}
|
||||
|
@ -121,6 +121,7 @@
|
||||
#define STANZA_NAME_LAST "last"
|
||||
#define STANZA_NAME_AFTER "after"
|
||||
#define STANZA_NAME_USERNAME "username"
|
||||
#define STANZA_NAME_PROPOSE "propose"
|
||||
|
||||
// error conditions
|
||||
#define STANZA_NAME_BAD_REQUEST "bad-request"
|
||||
@ -238,6 +239,8 @@
|
||||
#define STANZA_NS_RSM "http://jabber.org/protocol/rsm"
|
||||
#define STANZA_NS_REGISTER "jabber:iq:register"
|
||||
#define STANZA_NS_VOICEREQUEST "http://jabber.org/protocol/muc#request"
|
||||
#define STANZA_NS_JINGLE_MESSAGE "urn:xmpp:jingle-message:0"
|
||||
#define STANZA_NS_JINGLE_RTP "urn:xmpp:jingle:apps:rtp:1"
|
||||
|
||||
#define STANZA_DATAFORM_SOFTWARE "urn:xmpp:dataforms:softwareinfo"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user