From f7725943f89a4d5cf7f671ab67968138b0bdeed1 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Tue, 1 Mar 2016 21:57:27 +0000 Subject: [PATCH] Emit an event 'contactRequest' when a subscription request is received --- docs/source/development.rst | 2 ++ spec/protocol.js | 2 ++ src/converse-core.js | 49 +++++++++++++++++++++---------------- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/docs/source/development.rst b/docs/source/development.rst index 341e6778a..f30e1c8a0 100644 --- a/docs/source/development.rst +++ b/docs/source/development.rst @@ -751,6 +751,8 @@ Here are the different events that are emitted: +---------------------------------+---------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+ | **chatBoxToggled** | When a chat box has been minimized or maximized. | ``converse.listen.on('chatBoxToggled', function (event, chatbox) { ... });`` | +---------------------------------+---------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+ +| **contactRequest** | Someone has requested to subscribe to your presence (i.e. to be your contact). | ``converse.listen.on('contactRequest', function (event, user_data) { ... });`` | ++---------------------------------+---------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+ | **contactStatusChanged** | When a chat buddy's chat status has changed. | ``converse.listen.on('contactStatusChanged', function (event, buddy, status) { ... });`` | +---------------------------------+---------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+ | **contactStatusMessageChanged** | When a chat buddy's custom status message has changed. | ``converse.listen.on('contactStatusMessageChanged', function (event, buddy, messageText) { ... });`` | diff --git a/spec/protocol.js b/spec/protocol.js index 726dee74a..b734645b7 100644 --- a/spec/protocol.js +++ b/spec/protocol.js @@ -501,6 +501,7 @@ }); waits(50); runs(function () { + spyOn(converse, "emit"); /* *