Commit 66751540 authored by pzia's avatar pzia

contacts.add API to register contacts

- Basic test if the given jid contains @
- use jid as name if undefined
parent 896b147a
...@@ -5482,6 +5482,14 @@ ...@@ -5482,6 +5482,14 @@
return _transform(jids); return _transform(jids);
} }
return _.map(jids, _transform); return _.map(jids, _transform);
},
'add': function (jid, name) {
if (jid.indexOf('@') < 0) return false;
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': { 'chats': {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment