stfca 1.0.27 → 1.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/OldMessage.js CHANGED
@@ -329,7 +329,7 @@ module.exports = function (defaultFuncs, api, ctx) {
329
329
  handleUrl(msg, form, callback, () =>
330
330
  handleEmoji(msg, form, callback, () =>
331
331
  handleMention(msg, form, callback, () =>
332
- sendContent(form, threadID, isSingleUser, messageAndOTID, callback)
332
+ sendContent(form, threadID, isGroup, messageAndOTID, callback)
333
333
  )
334
334
  )
335
335
  )
@@ -344,7 +344,7 @@ module.exports = function (defaultFuncs, api, ctx) {
344
344
  handleUrl(msg, form, callback, () =>
345
345
  handleEmoji(msg, form, callback, () =>
346
346
  handleMention(msg, form, callback, () =>
347
- sendContent(form, threadID, isSingleUser, messageAndOTID, callback)
347
+ sendContent(form, threadID, isGroup, messageAndOTID, callback)
348
348
  )
349
349
  )
350
350
  )
@@ -23,6 +23,19 @@ function canBeCalled(func) {
23
23
 
24
24
  module.exports = function (defaultFuncs, api, ctx) {
25
25
  return function editMessage(text, messageID, callback) {
26
+ // ── editMessageE2EE: route E2EE messages through the bridge ──────────────
27
+ if (ctx.globalOptions && ctx.globalOptions.enableE2EE) {
28
+ var _e2eeMod = require('../e2ee');
29
+ var _jid = global._e2eeMessageMap && global._e2eeMessageMap.get(String(messageID));
30
+ if (_jid && _e2eeMod.isE2EEChatJid(_jid)) {
31
+ var _p = _e2eeMod.createBridge(ctx).editMessage(_jid, messageID, text)
32
+ .then(function (r) { if (typeof callback === "function") callback(null, r); return r; })
33
+ .catch(function (e) { if (typeof callback === "function") callback(e); throw e; });
34
+ return _p;
35
+ }
36
+ }
37
+ // ── end editMessageE2EE ───────────────────────────────────────────────────
38
+
26
39
  if (!ctx.mqttClient) {
27
40
  throw new Error('Not connected to MQTT');
28
41
  }
@@ -58,7 +71,7 @@ module.exports = function (defaultFuncs, api, ctx) {
58
71
  context.payload = JSON.stringify(context.payload);
59
72
 
60
73
  // if (canBeCalled(callback)) {
61
- // ctx.reqCallbacks[ctx.wsReqNumber] = callback;
74
+ // ctx.reqCallbacks[ctx.wsReqNumber] = callback;
62
75
  // }
63
76
 
64
77
  ctx.mqttClient.publish('/ls_req', JSON.stringify(context), {