Merge branch 'msg' of github.com:xwiki-labs/cryptpad into msg
This commit is contained in:
commit
bce0b03ba4
@ -10,6 +10,7 @@ define([
|
|||||||
'/common/common-userlist.js',
|
'/common/common-userlist.js',
|
||||||
'/common/common-title.js',
|
'/common/common-title.js',
|
||||||
'/common/common-metadata.js',
|
'/common/common-metadata.js',
|
||||||
|
'/common/common-messaging.js',
|
||||||
'/common/common-codemirror.js',
|
'/common/common-codemirror.js',
|
||||||
'/common/common-file.js',
|
'/common/common-file.js',
|
||||||
'/file/file-crypto.js',
|
'/file/file-crypto.js',
|
||||||
@ -19,7 +20,7 @@ define([
|
|||||||
'/customize/application_config.js',
|
'/customize/application_config.js',
|
||||||
'/common/media-tag.js',
|
'/common/media-tag.js',
|
||||||
], function ($, Config, Messages, Store, Util, Hash, UI, History, UserList, Title, Metadata,
|
], function ($, Config, Messages, Store, Util, Hash, UI, History, UserList, Title, Metadata,
|
||||||
CodeMirror, Files, FileCrypto, Clipboard, Pinpad, AppConfig, MediaTag) {
|
Messaging, CodeMirror, Files, FileCrypto, Clipboard, Pinpad, AppConfig, MediaTag) {
|
||||||
|
|
||||||
/* This file exposes functionality which is specific to Cryptpad, but not to
|
/* This file exposes functionality which is specific to Cryptpad, but not to
|
||||||
any particular pad type. This includes functions for committing metadata
|
any particular pad type. This includes functions for committing metadata
|
||||||
@ -109,6 +110,10 @@ define([
|
|||||||
common.serializeHash = Hash.serializeHash;
|
common.serializeHash = Hash.serializeHash;
|
||||||
common.createInviteUrl = Hash.createInviteUrl;
|
common.createInviteUrl = Hash.createInviteUrl;
|
||||||
|
|
||||||
|
// Messaging
|
||||||
|
common.addDirectMessageHandler = Messaging.addDirectMessageHandler;
|
||||||
|
common.inviteFromUserlist = Messaging.inviteFromUserlist;
|
||||||
|
|
||||||
// Userlist
|
// Userlist
|
||||||
common.createUserList = UserList.create;
|
common.createUserList = UserList.create;
|
||||||
|
|
||||||
@ -1192,22 +1197,6 @@ define([
|
|||||||
return button;
|
return button;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Messaging
|
|
||||||
var addDirectMessageHandler = function () {
|
|
||||||
var network = getNetwork();
|
|
||||||
if (!network) { return void console.error('Network not ready'); }
|
|
||||||
network.on('message', function (msg, sender) {
|
|
||||||
if (sender === network.historyKeeper) { return; }
|
|
||||||
|
|
||||||
});
|
|
||||||
};
|
|
||||||
common.inviteFromUserlist = function (netfluxId) {
|
|
||||||
var network = getNetwork();
|
|
||||||
network.sendto(netfluxId, '["FRIEND_REQ", "Salut"]')
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var emoji_patt = /([\uD800-\uDBFF][\uDC00-\uDFFF])/;
|
var emoji_patt = /([\uD800-\uDBFF][\uDC00-\uDFFF])/;
|
||||||
var isEmoji = function (str) {
|
var isEmoji = function (str) {
|
||||||
return emoji_patt.test(str);
|
return emoji_patt.test(str);
|
||||||
@ -1713,7 +1702,7 @@ define([
|
|||||||
Store.ready(function (err, storeObj) {
|
Store.ready(function (err, storeObj) {
|
||||||
store = common.store = env.store = storeObj;
|
store = common.store = env.store = storeObj;
|
||||||
|
|
||||||
addDirectMessageHandler();
|
common.addDirectMessageHandler(common);
|
||||||
|
|
||||||
var proxy = getProxy();
|
var proxy = getProxy();
|
||||||
var network = getNetwork();
|
var network = getNetwork();
|
||||||
|
|||||||
@ -209,13 +209,12 @@ define([
|
|||||||
var name = data.name || Messages.anonymous;
|
var name = data.name || Messages.anonymous;
|
||||||
var $span = $('<span>', {'title': name});
|
var $span = $('<span>', {'title': name});
|
||||||
var $rightCol = $('<span>', {'class': 'right-col'});
|
var $rightCol = $('<span>', {'class': 'right-col'});
|
||||||
var $name = $('<span>', {'class': 'name'}).text(name).appendTo($rightCol);
|
$('<span>', {'class': 'name'}).text(name).appendTo($rightCol);
|
||||||
// TODO: if account
|
// TODO: if account
|
||||||
var $button = $('<button>', {'class': 'friend'}).appendTo($rightCol);
|
var $button = $('<button>', {'class': 'friend'}).appendTo($rightCol);
|
||||||
$button.text('Add friend').click(function (e) {
|
$button.text('Add friend').click(function (e) {
|
||||||
console.log('TODO');
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
Cryptpad.inviteFromUserlist(data.netfluxId);
|
Cryptpad.inviteFromUserlist(Cryptpad, data.netfluxId);
|
||||||
});
|
});
|
||||||
// TODO: end if
|
// TODO: end if
|
||||||
if (data.profile) {
|
if (data.profile) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user