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
90641a61
Commit
90641a61
authored
Mar 30, 2015
by
JC Brand
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #354 from pzia/master
contacts.add API to register contacts
parents
896b147a
6879405e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
converse.js
converse.js
+16
-0
docs/source/development.rst
docs/source/development.rst
+13
-0
No files found.
converse.js
View file @
90641a61
...
...
@@ -5482,6 +5482,22 @@
return
_transform
(
jids
);
}
return
_
.
map
(
jids
,
_transform
);
},
'
add
'
:
function
(
jid
,
name
)
{
if
(
typeof
jid
===
"
undefined
"
)
{
throw
new
Error
(
"
Error: you must supply a jid
"
);
}
if
(
typeof
jid
!==
"
string
"
)
{
throw
new
Error
(
'
Error: wrong attribute (jid) type. Must be string.
'
);
}
if
(
jid
.
indexOf
(
'
@
'
)
<
0
)
{
throw
new
Error
(
'
Error: invalid jid
'
);
}
name
=
_
.
isEmpty
(
name
)?
jid
:
name
;
converse
.
connection
.
roster
.
add
(
jid
,
name
,
[],
function
(
iq
)
{
converse
.
connection
.
roster
.
subscribe
(
jid
,
null
,
converse
.
xmppstatus
.
get
(
'
fullname
'
));
});
return
true
;
}
},
'
chats
'
:
{
...
...
docs/source/development.rst
View file @
90641a61
...
...
@@ -272,6 +272,19 @@ The returned roster contact objects have these attributes:
| vcard_updated | When last the buddy's VCard was updated. |
+----------------+--------------------------------------------------------------------------------------------------------------------------------------+
add
~~~
Add a contact.
Provide the JID of the contact you want to add::
converse.chats.add('buddy@example.com')
You may also provide the fullname. If not present, we use the jid as fullname.
converse.chats.add('buddy@example.com', 'Buddy')
"chats" grouping
----------------
...
...
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