Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
9a449e36
Commit
9a449e36
authored
Mar 18, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comment indentation
parent
f65b99e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
49 deletions
+49
-49
src/converse-core.js
src/converse-core.js
+49
-49
No files found.
src/converse-core.js
View file @
9a449e36
...
@@ -726,11 +726,11 @@
...
@@ -726,11 +726,11 @@
subscribe
:
function
(
message
)
{
subscribe
:
function
(
message
)
{
/* Send a presence subscription request to this roster contact
/* Send a presence subscription request to this roster contact
*
*
* Parameters:
* Parameters:
* (String) message - An optional message to explain the
* (String) message - An optional message to explain the
* reason for the subscription request.
* reason for the subscription request.
*/
*/
this
.
save
(
'
ask
'
,
"
subscribe
"
);
// ask === 'subscribe' Means we have ask to subscribe to them.
this
.
save
(
'
ask
'
,
"
subscribe
"
);
// ask === 'subscribe' Means we have ask to subscribe to them.
var
pres
=
$pres
({
to
:
this
.
get
(
'
jid
'
),
type
:
"
subscribe
"
});
var
pres
=
$pres
({
to
:
this
.
get
(
'
jid
'
),
type
:
"
subscribe
"
});
if
(
message
&&
message
!==
""
)
{
if
(
message
&&
message
!==
""
)
{
...
@@ -746,10 +746,10 @@
...
@@ -746,10 +746,10 @@
ackSubscribe
:
function
()
{
ackSubscribe
:
function
()
{
/* Upon receiving the presence stanza of type "subscribed",
/* Upon receiving the presence stanza of type "subscribed",
* the user SHOULD acknowledge receipt of that subscription
* the user SHOULD acknowledge receipt of that subscription
* state notification by sending a presence stanza of type
* state notification by sending a presence stanza of type
* "subscribe" to the contact
* "subscribe" to the contact
*/
*/
converse
.
connection
.
send
(
$pres
({
converse
.
connection
.
send
(
$pres
({
'
type
'
:
'
subscribe
'
,
'
type
'
:
'
subscribe
'
,
'
to
'
:
this
.
get
(
'
jid
'
)
'
to
'
:
this
.
get
(
'
jid
'
)
...
@@ -758,31 +758,31 @@
...
@@ -758,31 +758,31 @@
ackUnsubscribe
:
function
(
jid
)
{
ackUnsubscribe
:
function
(
jid
)
{
/* Upon receiving the presence stanza of type "unsubscribed",
/* Upon receiving the presence stanza of type "unsubscribed",
* the user SHOULD acknowledge receipt of that subscription state
* the user SHOULD acknowledge receipt of that subscription state
* notification by sending a presence stanza of type "unsubscribe"
* notification by sending a presence stanza of type "unsubscribe"
* this step lets the user's server know that it MUST no longer
* this step lets the user's server know that it MUST no longer
* send notification of the subscription state change to the user.
* send notification of the subscription state change to the user.
* Parameters:
* Parameters:
* (String) jid - The Jabber ID of the user who is unsubscribing
* (String) jid - The Jabber ID of the user who is unsubscribing
*/
*/
converse
.
connection
.
send
(
$pres
({
'
type
'
:
'
unsubscribe
'
,
'
to
'
:
this
.
get
(
'
jid
'
)}));
converse
.
connection
.
send
(
$pres
({
'
type
'
:
'
unsubscribe
'
,
'
to
'
:
this
.
get
(
'
jid
'
)}));
this
.
destroy
();
// Will cause removeFromRoster to be called.
this
.
destroy
();
// Will cause removeFromRoster to be called.
},
},
unauthorize
:
function
(
message
)
{
unauthorize
:
function
(
message
)
{
/* Unauthorize this contact's presence subscription
/* Unauthorize this contact's presence subscription
* Parameters:
* Parameters:
* (String) message - Optional message to send to the person being unauthorized
* (String) message - Optional message to send to the person being unauthorized
*/
*/
converse
.
rejectPresenceSubscription
(
this
.
get
(
'
jid
'
),
message
);
converse
.
rejectPresenceSubscription
(
this
.
get
(
'
jid
'
),
message
);
return
this
;
return
this
;
},
},
authorize
:
function
(
message
)
{
authorize
:
function
(
message
)
{
/* Authorize presence subscription
/* Authorize presence subscription
* Parameters:
* Parameters:
* (String) message - Optional message to send to the person being authorized
* (String) message - Optional message to send to the person being authorized
*/
*/
var
pres
=
$pres
({
to
:
this
.
get
(
'
jid
'
),
type
:
"
subscribed
"
});
var
pres
=
$pres
({
to
:
this
.
get
(
'
jid
'
),
type
:
"
subscribed
"
});
if
(
message
&&
message
!==
""
)
{
if
(
message
&&
message
!==
""
)
{
pres
.
c
(
"
status
"
).
t
(
message
);
pres
.
c
(
"
status
"
).
t
(
message
);
...
@@ -812,9 +812,9 @@
...
@@ -812,9 +812,9 @@
removeFromRoster
:
function
(
callback
)
{
removeFromRoster
:
function
(
callback
)
{
/* Instruct the XMPP server to remove this contact from our roster
/* Instruct the XMPP server to remove this contact from our roster
* Parameters:
* Parameters:
* (Function) callback
* (Function) callback
*/
*/
var
iq
=
$iq
({
type
:
'
set
'
})
var
iq
=
$iq
({
type
:
'
set
'
})
.
c
(
'
query
'
,
{
xmlns
:
Strophe
.
NS
.
ROSTER
})
.
c
(
'
query
'
,
{
xmlns
:
Strophe
.
NS
.
ROSTER
})
.
c
(
'
item
'
,
{
jid
:
this
.
get
(
'
jid
'
),
subscription
:
"
remove
"
});
.
c
(
'
item
'
,
{
jid
:
this
.
get
(
'
jid
'
),
subscription
:
"
remove
"
});
...
@@ -870,15 +870,15 @@
...
@@ -870,15 +870,15 @@
addAndSubscribe
:
function
(
jid
,
name
,
groups
,
message
,
attributes
)
{
addAndSubscribe
:
function
(
jid
,
name
,
groups
,
message
,
attributes
)
{
/* Add a roster contact and then once we have confirmation from
/* Add a roster contact and then once we have confirmation from
* the XMPP server we subscribe to that contact's presence updates.
* the XMPP server we subscribe to that contact's presence updates.
* Parameters:
* Parameters:
* (String) jid - The Jabber ID of the user being added and subscribed to.
* (String) jid - The Jabber ID of the user being added and subscribed to.
* (String) name - The name of that user
* (String) name - The name of that user
* (Array of Strings) groups - Any roster groups the user might belong to
* (Array of Strings) groups - Any roster groups the user might belong to
* (String) message - An optional message to explain the
* (String) message - An optional message to explain the
* reason for the subscription request.
* reason for the subscription request.
* (Object) attributes - Any additional attributes to be stored on the user's model.
* (Object) attributes - Any additional attributes to be stored on the user's model.
*/
*/
this
.
addContact
(
jid
,
name
,
groups
,
attributes
).
done
(
function
(
contact
)
{
this
.
addContact
(
jid
,
name
,
groups
,
attributes
).
done
(
function
(
contact
)
{
if
(
contact
instanceof
converse
.
RosterContact
)
{
if
(
contact
instanceof
converse
.
RosterContact
)
{
contact
.
subscribe
(
message
);
contact
.
subscribe
(
message
);
...
@@ -989,11 +989,11 @@
...
@@ -989,11 +989,11 @@
onRosterPush
:
function
(
iq
)
{
onRosterPush
:
function
(
iq
)
{
/* Handle roster updates from the XMPP server.
/* Handle roster updates from the XMPP server.
* See: https://xmpp.org/rfcs/rfc6121.html#roster-syntax-actions-push
* See: https://xmpp.org/rfcs/rfc6121.html#roster-syntax-actions-push
*
*
* Parameters:
* Parameters:
* (XMLElement) IQ - The IQ stanza received from the XMPP server.
* (XMLElement) IQ - The IQ stanza received from the XMPP server.
*/
*/
var
id
=
iq
.
getAttribute
(
'
id
'
);
var
id
=
iq
.
getAttribute
(
'
id
'
);
var
from
=
iq
.
getAttribute
(
'
from
'
);
var
from
=
iq
.
getAttribute
(
'
from
'
);
if
(
from
&&
from
!==
""
&&
Strophe
.
getBareJidFromJid
(
from
)
!==
converse
.
bare_jid
)
{
if
(
from
&&
from
!==
""
&&
Strophe
.
getBareJidFromJid
(
from
)
!==
converse
.
bare_jid
)
{
...
@@ -1029,8 +1029,8 @@
...
@@ -1029,8 +1029,8 @@
onReceivedFromServer
:
function
(
iq
)
{
onReceivedFromServer
:
function
(
iq
)
{
/* An IQ stanza containing the roster has been received from
/* An IQ stanza containing the roster has been received from
* the XMPP server.
* the XMPP server.
*/
*/
converse
.
emit
(
'
roster
'
,
iq
);
converse
.
emit
(
'
roster
'
,
iq
);
$
(
iq
).
children
(
'
query
'
).
find
(
'
item
'
).
each
(
function
(
idx
,
item
)
{
$
(
iq
).
children
(
'
query
'
).
find
(
'
item
'
).
each
(
function
(
idx
,
item
)
{
this
.
updateContact
(
item
);
this
.
updateContact
(
item
);
...
@@ -1039,8 +1039,8 @@
...
@@ -1039,8 +1039,8 @@
updateContact
:
function
(
item
)
{
updateContact
:
function
(
item
)
{
/* Update or create RosterContact models based on items
/* Update or create RosterContact models based on items
* received in the IQ from the server.
* received in the IQ from the server.
*/
*/
var
jid
=
item
.
getAttribute
(
'
jid
'
);
var
jid
=
item
.
getAttribute
(
'
jid
'
);
if
(
this
.
isSelf
(
jid
))
{
return
;
}
if
(
this
.
isSelf
(
jid
))
{
return
;
}
var
groups
=
[],
var
groups
=
[],
...
@@ -1531,12 +1531,12 @@
...
@@ -1531,12 +1531,12 @@
this
.
Feature
=
Backbone
.
Model
;
this
.
Feature
=
Backbone
.
Model
;
this
.
Features
=
Backbone
.
Collection
.
extend
({
this
.
Features
=
Backbone
.
Collection
.
extend
({
/* Service Discovery
/* Service Discovery
* -----------------
* -----------------
* This collection stores Feature Models, representing features
* This collection stores Feature Models, representing features
* provided by available XMPP entities (e.g. servers)
* provided by available XMPP entities (e.g. servers)
* See XEP-0030 for more details: http://xmpp.org/extensions/xep-0030.html
* See XEP-0030 for more details: http://xmpp.org/extensions/xep-0030.html
* All features are shown here: http://xmpp.org/registrar/disco-features.html
* All features are shown here: http://xmpp.org/registrar/disco-features.html
*/
*/
model
:
converse
.
Feature
,
model
:
converse
.
Feature
,
initialize
:
function
()
{
initialize
:
function
()
{
this
.
addClientIdentities
().
addClientFeatures
();
this
.
addClientIdentities
().
addClientFeatures
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment