diff --git a/package-lock.json b/package-lock.json index 23b84a5..4a19a97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,9 +33,9 @@ "integrity": "sha512-lXKXfypKo644k4Da4yXkPCrwcvn6SlUW2X2zFbuflKHNjf0w9htru01bo26uMhleMXsDmnZ12eJLdrAZa9MANg==" }, "@sorunome/matrix-bot-sdk": { - "version": "0.5.3-1", - "resolved": "https://registry.npmjs.org/@sorunome/matrix-bot-sdk/-/matrix-bot-sdk-0.5.3-1.tgz", - "integrity": "sha512-WzYyN6jAtGGsDdYOVXqK0BZxPxw9aI1bNXOT7YViw76QWVmn9RnJjhzJqX5GcOsYunecltWEyrLiK/WN0PM+hA==", + "version": "0.5.3-2", + "resolved": "https://registry.npmjs.org/@sorunome/matrix-bot-sdk/-/matrix-bot-sdk-0.5.3-2.tgz", + "integrity": "sha512-kGbz+EudtS8iISEyfNnJEa29lA3tqzE7jUwaXUdkYqo2QuiNS0xnXi5zJDJoCycQEf5v0bWbVdtM+dEIilpTew==", "requires": { "@types/express": "^4.17.2", "chalk": "^3.0.0", @@ -177,9 +177,9 @@ } }, "@types/express-serve-static-core": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.4.tgz", - "integrity": "sha512-dPs6CaRWxsfHbYDVU51VjEJaUJEcli4UI0fFMT4oWmgCvHj+j7oIxz5MLHVL0Rv++N004c21ylJNdWQvPkkb5w==", + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.5.tgz", + "integrity": "sha512-578YH5Lt88AKoADy0b2jQGwJtrBxezXtVe/MBqWXKZpqx91SnC0pVkVCcxcytz3lWW+cHBYDi3Ysh0WXc+rAYw==", "requires": { "@types/node": "*", "@types/range-parser": "*" @@ -429,13 +429,6 @@ "qs": "6.7.0", "raw-body": "2.4.0", "type-is": "~1.6.17" - }, - "dependencies": { - "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" - } } }, "boolbase": { @@ -459,9 +452,9 @@ "optional": true }, "buffer": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.5.0.tgz", - "integrity": "sha512-9FTEDjLjwoAkEwyMGDjYJQN2gfRgOKBKRfiglhvibGbpeeU/pQn1bJxQqm32OD/AIeEuHxU9roxXxg34Byp/Ww==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", + "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", "requires": { "base64-js": "^1.0.2", "ieee754": "^1.1.4" @@ -921,11 +914,6 @@ "vary": "~1.1.2" }, "dependencies": { - "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" - }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -1436,16 +1424,16 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" }, "mime-db": { - "version": "1.43.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", - "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" }, "mime-types": { - "version": "2.1.26", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", - "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", "requires": { - "mime-db": "1.43.0" + "mime-db": "1.44.0" } }, "mimic-response": { @@ -1531,11 +1519,11 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "mx-puppet-bridge": { - "version": "0.0.38-1", - "resolved": "https://registry.npmjs.org/mx-puppet-bridge/-/mx-puppet-bridge-0.0.38-1.tgz", - "integrity": "sha512-69kQ2ntuzcmA8cn8S5dIxSUcuy31wDjpSeWSIjF+9osdALS/XTwh7/OVlTkUk4Wjh5WAeXba4na36BF80MTMYw==", + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/mx-puppet-bridge/-/mx-puppet-bridge-0.0.39.tgz", + "integrity": "sha512-0Lw7E06tbxci1V4Gkiijd8kdCU3o0PrTjxOBuoGI3zieOu7osAZ1TMzQ3rZKZddtboN8oy9h4/GkTqsIf9T67Q==", "requires": { - "@sorunome/matrix-bot-sdk": "^0.5.3-1", + "@sorunome/matrix-bot-sdk": "^0.5.3-2", "better-sqlite3": "^6.0.1", "events": "^3.1.0", "expire-set": "^1.0.0", @@ -1561,9 +1549,9 @@ "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, "node-abi": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.15.0.tgz", - "integrity": "sha512-FeLpTS0F39U7hHZU1srAK4Vx+5AHNVOTP+hxBNQknR/54laTHSFIJkDWDqiquY1LeLUgTfPN7sLPhMubx0PLAg==", + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.16.0.tgz", + "integrity": "sha512-+sa0XNlWDA6T+bDLmkCUYn6W5k5W6BPRL6mqzSCs6H/xUgtl4D5x2fORKDzopKiU6wsyn/+wXlRXwXeSp+mtoA==", "requires": { "semver": "^5.4.1" } @@ -1719,15 +1707,15 @@ "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, "pg": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.0.0.tgz", - "integrity": "sha512-jinx9Xcmkeh7Y7gatu2EJiXr37mcDeF0G5X14MjqPMwYjoZMk7PMMSTTXQQl03GRp2IICxo/zyybqfv2RNgXsg==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.0.3.tgz", + "integrity": "sha512-fvcNXn4o/iq4jKq15Ix/e58q3jPSmzOp6/8C3CaHoSR/bsxdg+1FXfDRePdtE/zBb3++TytvOrS1hNef3WC/Kg==", "requires": { "buffer-writer": "2.0.0", "packet-reader": "1.0.0", "pg-connection-string": "0.1.3", - "pg-packet-stream": "^1.1.0", - "pg-pool": "^3.0.0", + "pg-pool": "^3.1.1", + "pg-protocol": "^1.2.2", "pg-types": "^2.1.0", "pgpass": "1.x", "semver": "4.3.2" @@ -1755,27 +1743,27 @@ "resolved": "https://registry.npmjs.org/pg-minify/-/pg-minify-1.5.2.tgz", "integrity": "sha512-uZn/gXkGmO5JBdopxNLSpFMS1lXr+KJqynI8Di1Qyr8ZVXt67ruh+XNfzLMVdLzYv+MQRdNYQdVwWPSs0qM7xQ==" }, - "pg-packet-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pg-packet-stream/-/pg-packet-stream-1.1.0.tgz", - "integrity": "sha512-kRBH0tDIW/8lfnnOyTwKD23ygJ/kexQVXZs7gEyBljw4FYqimZFxnMMx50ndZ8In77QgfGuItS5LLclC2TtjYg==" - }, "pg-pool": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.1.0.tgz", - "integrity": "sha512-CvxGctDwjZZad6Q7vvhFA4BsYdk26UFIZaFH0XXqHId5uBOc26vco/GFh/laUVIQUpD9IKe/f9/mr/OQHyQ2ZA==" + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.1.1.tgz", + "integrity": "sha512-kYH6S0mcZF1TPg1F9boFee2JlCSm2oqnlR2Mz2Wgn1psQbEBNVeNTJCw2wCK48QsctwvGUzbxLMg/lYV6hL/3A==" }, "pg-promise": { - "version": "10.5.0", - "resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-10.5.0.tgz", - "integrity": "sha512-4eM/wnmymZA/NYqYojtK5OtZJNqdWKkHwYjT6zWIFnAWQyUnEsM8QWIgSAubGrzdf5rpsGnco8OjCoZxu3HCuw==", + "version": "10.5.2", + "resolved": "https://registry.npmjs.org/pg-promise/-/pg-promise-10.5.2.tgz", + "integrity": "sha512-PsLE6SaPHoe7b5QJhoYeKeNcyTM4YYczTR0YwOKFtCVuLGejfA8nUHlaJEM7NUcORfidVxW7RPaXmY/aCf3Nqw==", "requires": { "assert-options": "0.6.1", - "pg": "8.0.0", + "pg": "8.0.3", "pg-minify": "1.5.2", "spex": "3.0.1" } }, + "pg-protocol": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.2.2.tgz", + "integrity": "sha512-r8hGxHOk3ccMjjmhFJ/QOSVW5A+PP84TeRlEwB/cQ9Zu+bvtZg8Z59Cx3AMfVQc9S0Z+EG+HKhicF1W1GN5Eqg==" + }, "pg-types": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", @@ -1832,9 +1820,9 @@ "integrity": "sha1-AntTPAqokOJtFy1Hz5zOzFIazTU=" }, "postgres-date": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.4.tgz", - "integrity": "sha512-bESRvKVuTrjoBluEcpv2346+6kgB7UlnqWZsnbnCccTNq/pqfj1j6oBaN5+b/NrDXepYUT/HKadqv3iS9lJuVA==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.5.tgz", + "integrity": "sha512-pdau6GRPERdAYUQwkBnGKxEfPyhVZXG/JiS44iZWiNdSOWE09N2lUgN6yshuq6fVSon4Pm0VMXd1srUUkLe9iA==" }, "postgres-interval": { "version": "1.2.0", @@ -1899,6 +1887,11 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, + "qs": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + }, "range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", diff --git a/package.json b/package.json index c56f640..d56ae1c 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "events": "^3.0.0", "expire-set": "^1.0.0", "js-yaml": "^3.13.1", - "mx-puppet-bridge": "0.0.38-1", + "mx-puppet-bridge": "0.0.39", "node-emoji": "^1.10.0", "node-html-parser": "^1.2.13", "tslint": "^5.17.0", diff --git a/src/skype.ts b/src/skype.ts index 73fb03c..be3a8c1 100644 --- a/src/skype.ts +++ b/src/skype.ts @@ -378,7 +378,7 @@ export class Skype { const eventId = ret && ret.MessageId; this.messageDeduplicator.unlock(dedupeKey, p.client.username, eventId); if (eventId) { - await this.puppet.eventSync.insert(room.puppetId, data.eventId!, eventId); + await this.puppet.eventSync.insert(room, data.eventId!, eventId); } } @@ -405,7 +405,7 @@ export class Skype { const newEventId = ""; this.messageDeduplicator.unlock(dedupeKey, p.client.username, newEventId); if (newEventId) { - await this.puppet.eventSync.insert(room.puppetId, data.eventId!, newEventId); + await this.puppet.eventSync.insert(room, data.eventId!, newEventId); } } @@ -432,22 +432,24 @@ export class Skype { const authorname = escapeHtml(ownContact ? ownContact.displayName : p.client.username); const conversationId = escapeHtml(conversation.id); const timestamp = Math.round(Number(eventId) / 1000).toString(); - const origEventId = (await this.puppet.eventSync.getMatrix(room.puppetId, eventId))[0]; + const origEventId = (await this.puppet.eventSync.getMatrix(room, eventId))[0]; let contents = "blah"; if (origEventId) { - const [realOrigEventId, roomId] = origEventId.split(";"); - try { - const client = (await this.puppet.roomSync.getRoomOp(roomId)) || this.puppet.botIntent.underlyingClient; - const evt = await client.getEvent(roomId, realOrigEventId); - if (evt && evt.content && typeof evt.content.body === "string") { - if (evt.content.formatted_body) { - contents = this.matrixMessageParser.parse(evt.content.formatted_body); - } else { - contents = escapeHtml(evt.content.body); + const roomId = await this.puppet.roomSync.maybeGetMxid(room); + if (roomId) { + try { + const client = (await this.puppet.roomSync.getRoomOp(roomId)) || this.puppet.botIntent.underlyingClient; + const evt = await client.getEvent(roomId, origEventId); + if (evt && evt.content && typeof evt.content.body === "string") { + if (evt.content.formatted_body) { + contents = this.matrixMessageParser.parse(evt.content.formatted_body); + } else { + contents = escapeHtml(evt.content.body); + } } + } catch (err) { + log.verbose("Event not found", err.body || err); } - } catch (err) { - log.verbose("Event not found", err.body || err); } } const quote = `