pull/429/head
Beaudan Brown 6 years ago
parent 662c64f347
commit 895cedc801

@ -790,8 +790,8 @@ async function updateToLokiSchemaVersion1(currentVersion, instance) {
ADD COLUMN serverId STRING;`
);
const initConversation = async (data) => {
let { id, type, name, friendRequestStatus } = data;
const initConversation = async data => {
const { id, type, name, friendRequestStatus } = data;
await instance.run(
`INSERT INTO conversations (
id,
@ -820,7 +820,7 @@ async function updateToLokiSchemaVersion1(currentVersion, instance) {
$friendRequestStatus: friendRequestStatus,
}
);
}
};
const baseData = {
friendRequestStatus: 4, // Friends
@ -832,7 +832,7 @@ async function updateToLokiSchemaVersion1(currentVersion, instance) {
unreadCount: 0,
verified: 0,
version: 2,
}
};
const publicChatData = {
...baseData,

@ -213,9 +213,7 @@
);
window.feeds = [];
rssFeedConversations.forEach(conversation => {
window.feeds.push(
new window.LokiRssAPI(conversation.getRssSettings())
);
window.feeds.push(new window.LokiRssAPI(conversation.getRssSettings()));
});
window.lokiMessageAPI = new window.LokiMessageAPI(ourKey);
window.lokiPublicChatAPI = new window.LokiPublicChatAPI(ourKey);

@ -1,25 +0,0 @@
const friendRequestStatusEnum = Object.freeze({
// New conversation, no messages sent or received
none: 0,
// This state is used to lock the input early while sending
pendingSend: 1,
// Friend request sent, awaiting response
requestSent: 2,
// Friend request received, awaiting user input
requestReceived: 3,
// We did it!
friends: 4,
// Friend Request sent but timed out
requestExpired: 5,
});
// node and browser compatibility
(function exportLocalVariable(ref) {
if (ref.constructor.name === 'Module') {
// node
module.exports = friendRequestStatusEnum;
} else {
// browser
// friendRequestStatusEnum should be already set
}
})(typeof module === 'undefined' ? this : module);

@ -1,39 +1,14 @@
/* eslint-disable no-await-in-loop */
/* eslint-disable no-loop-func */
/* global log, window, textsecure, ConversationController */
/* global log, window, textsecure */
const EventEmitter = require('events');
const nodeFetch = require('node-fetch');
const friendRequestStatusEnum = require('./loki_friend_request_status');
const PER_MIN = 60 * 1000;
const PER_HR = 60 * PER_MIN;
const RSS_POLL_EVERY = 1 * PER_HR; // once an hour
/*
const dnsUtil = require('dns');
// how do we get our local version?
// how do we integrate with extensions.expired()
const VERSION_HOST = 'lastreleasedate.messenger.loki.network';
function getLastRelease(cb) {
// doesn't look to have a promise interface
dnsUtil.resolveTxt(VERSION_HOST, function handleResponse(err, records) {
if (err) {
console.error('getLastRelease error', err);
cb();
return;
}
if (records.length) {
cb();
}
// return first record...
cb(records[0]);
});
}
*/
function xml2json(xml) {
try {
let obj = {};

@ -77,7 +77,10 @@ MessageReceiver.prototype.extend({
});
this.httpPollingResource.pollServer();
localLokiServer.on('message', this.handleP2pMessage.bind(this));
lokiPublicChatAPI.on('publicMessage', this.handleUnencryptedMessage.bind(this));
lokiPublicChatAPI.on(
'publicMessage',
this.handleUnencryptedMessage.bind(this)
);
// set up pollers for any RSS feeds
feeds.forEach(feed => {
feed.on('rssMessage', this.handleUnencryptedMessage.bind(this));

Loading…
Cancel
Save