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
8843910d
Commit
8843910d
authored
Sep 22, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add API method to retrieve buddy attributes. fixes #223
parent
46400efa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
converse.js
converse.js
+6
-0
spec/converse.js
spec/converse.js
+10
-0
No files found.
converse.js
View file @
8843910d
...
...
@@ -4621,6 +4621,12 @@
'
initialize
'
:
function
(
settings
,
callback
)
{
converse
.
initialize
(
settings
,
callback
);
},
'
getBuddy
'
:
function
(
jid
)
{
var
contact
=
converse
.
roster
.
get
(
Strophe
.
getBareJidFromJid
(
jid
));
if
(
contact
)
{
return
contact
.
attributes
;
}
},
'
getRID
'
:
function
()
{
if
(
converse
.
expose_rid_and_sid
&&
typeof
converse
.
connection
!==
"
undefined
"
)
{
return
converse
.
connection
.
rid
||
converse
.
connection
.
_proto
.
rid
;
...
...
spec/converse.js
View file @
8843910d
...
...
@@ -43,5 +43,15 @@
// Restore the connection
converse
.
connection
=
old_connection
;
},
converse
));
it
(
"
has an API method for retrieving a buddy's attributes
"
,
$
.
proxy
(
function
()
{
var
jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
expect
(
converse_api
.
getBuddy
(
jid
)).
toBeFalsy
();
test_utils
.
createContacts
(
'
current
'
);
var
attrs
=
converse_api
.
getBuddy
(
jid
);
expect
(
typeof
attrs
).
toBe
(
'
object
'
);
expect
(
attrs
.
fullname
).
toBe
(
mock
.
cur_names
[
0
]);
expect
(
attrs
.
jid
).
toBe
(
jid
);
},
converse
));
},
converse
,
mock
,
test_utils
));
}));
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