2013-05-11 14:20:07 +02:00
|
|
|
(function (root, factory) {
|
2013-07-25 09:45:35 +02:00
|
|
|
define("mock",
|
|
|
|
['converse'],
|
|
|
|
function() {
|
|
|
|
return factory();
|
2013-05-11 14:20:07 +02:00
|
|
|
});
|
|
|
|
}(this, function (converse) {
|
|
|
|
var mock_connection = {
|
|
|
|
'muc': {
|
|
|
|
'listRooms': function () {},
|
|
|
|
'join': function () {},
|
2013-05-14 09:43:49 +02:00
|
|
|
'leave': function () {},
|
2013-05-31 09:41:09 +02:00
|
|
|
'rooms': {}
|
2013-05-11 14:20:07 +02:00
|
|
|
},
|
|
|
|
'jid': 'dummy@localhost',
|
2013-07-25 09:45:35 +02:00
|
|
|
'addHandler': function (handler, ns, name, type, id, from, options) {
|
2013-05-11 14:20:07 +02:00
|
|
|
return function () {};
|
|
|
|
},
|
|
|
|
'send': function () {},
|
|
|
|
'roster': {
|
|
|
|
'add': function () {},
|
|
|
|
'authorize': function () {},
|
|
|
|
'unauthorize': function () {},
|
|
|
|
'get': function () {},
|
|
|
|
'subscribe': function () {},
|
2013-08-24 15:33:06 +02:00
|
|
|
'registerCallback': function () {},
|
|
|
|
'remove': function (jid, callback) { callback(); }
|
2013-05-11 14:20:07 +02:00
|
|
|
},
|
2013-07-25 09:45:35 +02:00
|
|
|
'vcard': {
|
2013-05-11 14:20:07 +02:00
|
|
|
'get': function (callback, jid) {
|
2013-05-31 20:52:10 +02:00
|
|
|
var firstname, lastname;
|
|
|
|
if (!jid) {
|
|
|
|
jid = 'dummy@localhost';
|
|
|
|
firstname = 'Max';
|
|
|
|
lastname = 'Mustermann';
|
|
|
|
} else {
|
|
|
|
var name = jid.split('@')[0].replace('.', ' ').split(' ');
|
|
|
|
firstname = name[0].charAt(0).toUpperCase()+name[0].slice(1);
|
|
|
|
lastname = name[1].charAt(0).toUpperCase()+name[1].slice(1);
|
|
|
|
}
|
2013-05-11 14:20:07 +02:00
|
|
|
var fullname = firstname+' '+lastname;
|
|
|
|
var vcard = $iq().c('vCard').c('FN').t(fullname);
|
|
|
|
callback(vcard.tree());
|
2013-07-25 09:45:35 +02:00
|
|
|
}
|
2013-05-11 14:20:07 +02:00
|
|
|
},
|
|
|
|
'disco': {
|
|
|
|
'info': function () {},
|
|
|
|
'items': function () {}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
return mock_connection;
|
|
|
|
}));
|