iobroker.imap 0.1.2 → 0.1.3
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/README.md +10 -3
- package/admin/blockly.js +17 -0
- package/io-package.json +14 -14
- package/lib/Connection.js +9 -6
- package/lib/imap_event.js +32 -7
- package/main.js +17 -3
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|

|
|
14
14
|
</br>
|
|
15
15
|
**Version:** </br>
|
|
16
|
-

|
|
17
17
|
|
|
18
18
|
[](https://nodei.co/npm/iobroker.imap/)
|
|
19
19
|
|
|
20
20
|
**Tests:** </br>
|
|
21
|
-
](https://github.com/Lucky-ESA/ioBroker.imap/actions/workflows/test-and-release.yml)
|
|
22
22
|
[](https://github.com/Lucky-ESA/ioBroker.imap/actions/workflows/codeql.yml)
|
|
23
|
+
[](https://snyk.io/test/github/Lucky-ESA/ioBroker.imap)
|
|
23
24
|
|
|
24
25
|
## imap adapter for ioBroker
|
|
25
26
|
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
|
|
48
49
|
## Questions
|
|
49
50
|
|
|
50
|
-
🇩🇪 [Fragen](https://forum.iobroker.net/topic/63400/test-adapter-iobroker-imap-
|
|
51
|
+
🇩🇪 [Fragen](https://forum.iobroker.net/topic/63400/test-adapter-iobroker-imap-latest-stable)
|
|
51
52
|
|
|
52
53
|
## Changelog
|
|
53
54
|
|
|
@@ -55,6 +56,12 @@
|
|
|
55
56
|
Placeholder for the next version (at the beginning of the line):
|
|
56
57
|
### **WORK IN PROGRESS**
|
|
57
58
|
-->
|
|
59
|
+
### 0.1.3 (2024-03-06)
|
|
60
|
+
|
|
61
|
+
- (Lucky-ESA) Fixed setFlag
|
|
62
|
+
- (Lucky-ESA) Fixed sendTo error during instance deletion ([#57](https://github.com/Lucky-ESA/ioBroker.imap/issues/57))
|
|
63
|
+
- (Lucky-ESA) Mass email shift intercepted
|
|
64
|
+
|
|
58
65
|
### 0.1.2 (2024-01-24)
|
|
59
66
|
|
|
60
67
|
- (Lucky-ESA) Added missing translate
|
package/admin/blockly.js
CHANGED
|
@@ -20,6 +20,19 @@ Blockly.Translate =
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
/// --- SendTo imap --------------------------------------------------
|
|
23
|
+
Blockly.Words["no_instance_found"] = {
|
|
24
|
+
en: "No instance found",
|
|
25
|
+
de: "Keine Instanz gefunden",
|
|
26
|
+
ru: "Не найден",
|
|
27
|
+
pt: "Nenhuma instância encontrada",
|
|
28
|
+
nl: "Geen instantie gevonden",
|
|
29
|
+
fr: "Aucune instance trouvée",
|
|
30
|
+
it: "Nessun caso trovato",
|
|
31
|
+
es: "No hay caso encontrado",
|
|
32
|
+
pl: "Brak",
|
|
33
|
+
uk: "Не знайдено",
|
|
34
|
+
"zh-cn": "未找到实例",
|
|
35
|
+
};
|
|
23
36
|
Blockly.Words["imap"] = {
|
|
24
37
|
en: "IMAP",
|
|
25
38
|
de: "IMAP",
|
|
@@ -425,6 +438,7 @@ Blockly.Blocks["imap"] = {
|
|
|
425
438
|
}
|
|
426
439
|
}
|
|
427
440
|
}
|
|
441
|
+
if (Object.keys(options_instance).length == 0) options_instance.push([Blockly.Translate("no_instance_found"), ""]);
|
|
428
442
|
|
|
429
443
|
this.appendDummyInput("INSTANCE")
|
|
430
444
|
.appendField(Blockly.Translate("imap"))
|
|
@@ -544,6 +558,7 @@ Blockly.Blocks["imap_request"] = {
|
|
|
544
558
|
}
|
|
545
559
|
}
|
|
546
560
|
}
|
|
561
|
+
if (Object.keys(options_instance).length == 0) options_instance.push([Blockly.Translate("no_instance_found"), ""]);
|
|
547
562
|
|
|
548
563
|
this.appendDummyInput("INSTANCE")
|
|
549
564
|
.appendField(Blockly.Translate("imap"))
|
|
@@ -687,6 +702,7 @@ Blockly.Blocks["imap_data"] = {
|
|
|
687
702
|
}
|
|
688
703
|
}
|
|
689
704
|
}
|
|
705
|
+
if (Object.keys(options_instance).length == 0) options_instance.push([Blockly.Translate("no_instance_found"), ""]);
|
|
690
706
|
|
|
691
707
|
this.appendDummyInput("INSTANCE")
|
|
692
708
|
.appendField(Blockly.Translate("imap"))
|
|
@@ -812,6 +828,7 @@ Blockly.Blocks["imap_flag"] = {
|
|
|
812
828
|
}
|
|
813
829
|
}
|
|
814
830
|
}
|
|
831
|
+
if (Object.keys(options_instance).length == 0) options_instance.push([Blockly.Translate("no_instance_found"), ""]);
|
|
815
832
|
|
|
816
833
|
this.appendDummyInput("INSTANCE")
|
|
817
834
|
.appendField(Blockly.Translate("imap"))
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "imap",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.1.3": {
|
|
7
|
+
"en": "Fixed setFlag\nFixed sendTo error during instance deletion ([#57](https://github.com/Lucky-ESA/ioBroker.imap/issues/57))\nMass email shift intercepted",
|
|
8
|
+
"de": "Fixed set Flagge\nFester Versand Fehler bei der Löschung von Instanzen ([#57](https://github.com/Lucky-ESA/ioBroker.imap/issues/57))\nMassen-E-Mail-Schicht abgefangen",
|
|
9
|
+
"ru": "Фиксированный набор Флаг\nFixed send Ошибка во время удаления ([#57] (https://github.com/Lucky-ESA/ioBroker.imap/issues/57))\nМассовый смещение электронной почты перехвачено",
|
|
10
|
+
"pt": "Conjunto fixo Bandeira\nEnviar fixo Para erro durante a exclusão de instância ([#57](https://github.com/Lucky-ESA/ioBroker.imap/issues/57))\nMudança de e-mail em massa interceptada",
|
|
11
|
+
"nl": "Vaste set Vlag\nVaste verzending Fout tijdens het verwijderen van instantie ([#57](https://github.com/Lucky-ESA/ioBroker.imap/issues/57))\nOnderschepte massa-e-mailverschuiving",
|
|
12
|
+
"fr": "Set fixe Drapeau\nEnvoi fixe Erreur lors de la suppression de l'instance ([#57](https://github.com/Lucky-ESA/ioBroker.imap/issues/57)\nChangement d'email de masse intercepté",
|
|
13
|
+
"it": "Set fisso Bandiera\nInviato fisso Per errore durante la cancellazione delle istanze ([#57](https://github.com/Lucky-ESA/ioBroker.imap/issues/57))\nSpostamento email di massa intercettato",
|
|
14
|
+
"es": "Juego fijo Bandera\nEnvío fijo To error during instance deletion ([#57](https://github.com/Lucky-ESA/ioBroker.imap/issues/57))\nCambio de correo electrónico interceptado",
|
|
15
|
+
"pl": "Zestaw stały Flaga\nPoprawiono wysyłanie Do błędu podczas usuwania instancji ([# 57] (https: / / github.com / Lucky- ESA / ioBroker.imap / issues / 57))\nMass email przesunięcie przechwycone",
|
|
16
|
+
"uk": "Фіксований набір Прапор\nВиправлена відправка Помилки ([#57](https://github.com/Lucky-ESA/ioBroker.imap/issues/57))\nМасова зміна електронної пошти",
|
|
17
|
+
"zh-cn": "固定设备 旗帜\n固定发送 删除实例时出现错误([#57](https://github.com/Lucky-ESA/ioBroker.imap/issues/57))\n已截取大宗电子邮件"
|
|
18
|
+
},
|
|
6
19
|
"0.1.2": {
|
|
7
20
|
"en": "Added missing translate\nUpdated package\nBug fixes",
|
|
8
21
|
"de": "Hinzugefügt fehlende Übersetzung\nAktualisiertes Paket\nFehlerbehebungen",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "Fix koryguje pole widzenia i niespodzianek\nZadaniowe możliwości\nPrzemiana kryzysowa bez restartu\nAdded outlook.office365.com oauth2 login\nAdded Connection.js from Module to Adapter\nBug",
|
|
81
94
|
"uk": "Фіксувати правильну лічильник для видимих і невидимих\nДодаткові можливості\nЗміни критерії без перезапуску\nEnglish, Українська, Français..\nДодано Connection.js від Module до адаптера\nВиправлення помилок",
|
|
82
95
|
"zh-cn": "Fix 纠正被发现和无见的反击\n增加能力\n2. 标准改变,而不恢复原状\n增加前景\nA. 添加了Anection.js from Module to Adapter\nBug fix"
|
|
83
|
-
},
|
|
84
|
-
"0.0.6": {
|
|
85
|
-
"en": "Added trigger move or copy emails\nAdded JSON for multiple IMAP accounts\nBug fixes",
|
|
86
|
-
"de": "Trigger-Bewegung oder Kopie-E-Mails hinzugefügt\nJSON für mehrere IMAP-Konten hinzugefügt\nFehlerbehebungen",
|
|
87
|
-
"ru": "Добавлены триггеры или копировать электронные письма\nДобавлен JSON для нескольких учетных записей IMAP\nИсправления ошибок",
|
|
88
|
-
"pt": "Adicionado movimento do gatilho ou copiar e-mails\nAdicionado JSON para múltiplas contas IMAP\nCorreções de bugs",
|
|
89
|
-
"nl": "Verplaatsing of mails\n_\nBug repareert",
|
|
90
|
-
"fr": "Ajout d'un déménagement ou d'une copie des courriels\nJSON ajouté pour plusieurs comptes IMAP\nCorrections",
|
|
91
|
-
"it": "Aggiunta di attivazione spostare o copiare e-mail\nAggiunto JSON per più account IMAP\nCorrezioni di bug",
|
|
92
|
-
"es": "Añadido movimiento de gatillo o copiar correos electrónicos\nAñadido JSON para múltiples cuentas de IMAP\nCorrección de errores",
|
|
93
|
-
"pl": "Added trigger move lub copy mail\nAdded JSON dla wielu kont IMAP\nBug",
|
|
94
|
-
"uk": "Доданий тригер переміщення або копіювання електронних листів\nДодано JSON для декількох облікових записів IMAP\nВиправлення помилок",
|
|
95
|
-
"zh-cn": "增购机或邮票\n增聘联合办多管方案账户\nBug fix"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
package/lib/Connection.js
CHANGED
|
@@ -728,8 +728,8 @@ class Connection extends EventEmitter {
|
|
|
728
728
|
const req = this._queue !== undefined ? this._queue[this._queue.length - 1] : 0;
|
|
729
729
|
req.fetchCache = {};
|
|
730
730
|
req.fetching = fetching;
|
|
731
|
-
this.debug("FETCH: " + JSON.stringify(fetching));
|
|
732
|
-
this.debug("CMD: " + cmd);
|
|
731
|
+
this.debug && this.debug("FETCH: " + JSON.stringify(fetching));
|
|
732
|
+
this.debug && this.debug("CMD: " + cmd);
|
|
733
733
|
return (req.bodyEmitter = new EventEmitter());
|
|
734
734
|
}
|
|
735
735
|
// Extension methods ===========================================================
|
|
@@ -1092,12 +1092,15 @@ class Connection extends EventEmitter {
|
|
|
1092
1092
|
this._curReq.cbargs.push(box);
|
|
1093
1093
|
} else if (type === "fetch") {
|
|
1094
1094
|
if (this._curReq && this._curReq.fullcmd) {
|
|
1095
|
-
this.debug("this._curReq.fullcmd: " + this._curReq.fullcmd);
|
|
1095
|
+
this.debug && this.debug("this._curReq.fullcmd: " + this._curReq.fullcmd);
|
|
1096
1096
|
}
|
|
1097
|
-
this.debug("infos: " + JSON.stringify(info));
|
|
1097
|
+
this.debug && this.debug("infos: " + JSON.stringify(info));
|
|
1098
1098
|
if (this._curReq && this._curReq.fullcmd != null && /^(?:UID )?FETCH/.test(this._curReq.fullcmd)) {
|
|
1099
|
-
this.debug("this._curReq.fullcmd: " + this._curReq.fullcmd);
|
|
1100
|
-
this.debug
|
|
1099
|
+
this.debug && this.debug("this._curReq.fullcmd: " + this._curReq.fullcmd);
|
|
1100
|
+
this.debug &&
|
|
1101
|
+
this.debug(
|
|
1102
|
+
"this._curReq.fetchCache[info.num]: " + JSON.stringify(this._curReq.fetchCache[info.num]),
|
|
1103
|
+
);
|
|
1101
1104
|
// FETCH response sent as result of FETCH request
|
|
1102
1105
|
const msg = this._curReq.fetchCache[info.num];
|
|
1103
1106
|
const keys = Object.keys(info.text);
|
package/lib/imap_event.js
CHANGED
|
@@ -296,16 +296,41 @@ module.exports = {
|
|
|
296
296
|
const isRange = this.all_seqno[client].findIndex((number) => number == seqno);
|
|
297
297
|
if (isRange != -1 && (isRange < this.clientsRaw[client].max || isRange == this.clientsRaw[client].max)) {
|
|
298
298
|
this.log_translator("info", "EMail deleted in scope", client, seqno);
|
|
299
|
-
|
|
300
|
-
this.readMailsSort(client);
|
|
301
|
-
} else {
|
|
302
|
-
this.readMails(client);
|
|
303
|
-
}
|
|
299
|
+
this.clientsRaw[client].isonExpunge = true;
|
|
304
300
|
} else {
|
|
305
301
|
this.log_translator("info", "EMail deleted", client, seqno);
|
|
306
302
|
}
|
|
307
|
-
this.
|
|
308
|
-
|
|
303
|
+
this.clientsRaw[client].seqonExpunge.push(seqno);
|
|
304
|
+
if (this.clientsRaw[client].onExpungeTimer) {
|
|
305
|
+
this.clearTimeout(this.clientsRaw[client].onExpungeTimer);
|
|
306
|
+
this.clientsRaw[client].onExpungeTimer = null;
|
|
307
|
+
++this.clientsRaw[client].onExpunge;
|
|
308
|
+
}
|
|
309
|
+
this.clientsRaw[client].onExpungeTimer = this.setTimeout(() => {
|
|
310
|
+
if (this.clientsRaw[client].onExpunge > 1) {
|
|
311
|
+
if (this.clientsRaw[client].isonExpunge) {
|
|
312
|
+
if (this.clients[client].serverSupports("SORT")) {
|
|
313
|
+
this.readMailsSort(client);
|
|
314
|
+
} else {
|
|
315
|
+
this.readMails(client);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
this.setUpdate(client, { seqno: this.clientsRaw[client].seqonExpunge }, "move_copy");
|
|
319
|
+
} else {
|
|
320
|
+
if (this.clientsRaw[client].isonExpunge) {
|
|
321
|
+
if (this.clients[client].serverSupports("SORT")) {
|
|
322
|
+
this.readMailsSort(client);
|
|
323
|
+
} else {
|
|
324
|
+
this.readMails(client);
|
|
325
|
+
}
|
|
326
|
+
this.setUpdate(client, { seqno: seqno }, "move_copy");
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
this.clientsRaw[client].seqonExpunge = [];
|
|
330
|
+
this.setTotal(client, this.clientsRaw[client].inbox_activ);
|
|
331
|
+
this.clientsRaw[client].onExpunge = 0;
|
|
332
|
+
this.clientsRaw[client].isonExpunge = false;
|
|
333
|
+
}, 1000);
|
|
309
334
|
},
|
|
310
335
|
/**
|
|
311
336
|
* Event if UIDs in this mailbox have changed since the last time this mailbox was opened.
|
package/main.js
CHANGED
|
@@ -223,6 +223,10 @@ class Imap extends utils.Adapter {
|
|
|
223
223
|
await this.cleanupDatapoints(dev);
|
|
224
224
|
continue;
|
|
225
225
|
}
|
|
226
|
+
dev.onExpunge = 0;
|
|
227
|
+
dev.seqonExpunge = [];
|
|
228
|
+
dev.isonExpunge = false;
|
|
229
|
+
dev.onExpungeTimer = null;
|
|
226
230
|
this.clientsHTML[dev.user] = {};
|
|
227
231
|
this.boxfolder[dev.user] = {};
|
|
228
232
|
this.restartIMAPConnection[dev.user] = null;
|
|
@@ -1185,12 +1189,14 @@ class Imap extends utils.Adapter {
|
|
|
1185
1189
|
onUnload(callback) {
|
|
1186
1190
|
try {
|
|
1187
1191
|
for (const dev of this.clientsID) {
|
|
1192
|
+
this.clientsRaw[dev].onExpungeTimer && this.clearTimeout(this.clientsRaw[dev].onExpungeTimer);
|
|
1188
1193
|
this.clients[dev] = null;
|
|
1189
1194
|
this.restartIMAPConnection[dev] && this.clearTimeout(this.restartIMAPConnection[dev]);
|
|
1190
1195
|
this.setState(`${dev}.online`, {
|
|
1191
1196
|
val: false,
|
|
1192
1197
|
ack: true,
|
|
1193
1198
|
});
|
|
1199
|
+
this.clientsRaw[dev] = null;
|
|
1194
1200
|
}
|
|
1195
1201
|
this.qualityInterval && this.clearInterval(this.qualityInterval);
|
|
1196
1202
|
this.statusInterval && this.clearInterval(this.statusInterval);
|
|
@@ -1278,6 +1284,14 @@ class Imap extends utils.Adapter {
|
|
|
1278
1284
|
this.setAckFlag(id);
|
|
1279
1285
|
return;
|
|
1280
1286
|
}
|
|
1287
|
+
if (command === "set") {
|
|
1288
|
+
this.setAckFlag(id);
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
if (command === "type") {
|
|
1292
|
+
this.setAckFlag(id);
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1281
1295
|
if (command === "folder") {
|
|
1282
1296
|
this.setAckFlag(id);
|
|
1283
1297
|
return;
|
|
@@ -1401,15 +1415,15 @@ class Imap extends utils.Adapter {
|
|
|
1401
1415
|
*/
|
|
1402
1416
|
async applyFlag(clientID, set, uid, type) {
|
|
1403
1417
|
if (this.clients[clientID]) {
|
|
1404
|
-
if (set == "") {
|
|
1418
|
+
if (set == "" || set == null) {
|
|
1405
1419
|
const sets = await this.getStateAsync(`${clientID}.remote.flag.set`);
|
|
1406
1420
|
set = sets && sets.val ? sets.val.toString() : "";
|
|
1407
1421
|
}
|
|
1408
|
-
if (uid === 0) {
|
|
1422
|
+
if (uid === 0 || uid == null) {
|
|
1409
1423
|
const uids = await this.getStateAsync(`${clientID}.remote.flag.uid`);
|
|
1410
1424
|
uid = uids && uids.val != null ? Number(uids.val) : 0;
|
|
1411
1425
|
}
|
|
1412
|
-
if (type == "") {
|
|
1426
|
+
if (type == "" || type == null) {
|
|
1413
1427
|
const types = await this.getStateAsync(`${clientID}.remote.flag.type`);
|
|
1414
1428
|
type = types && types.val ? types.val.toString() : "";
|
|
1415
1429
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.imap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "imap to receive your emails",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Lucky-ESA",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@iobroker/adapter-core": "^3.0.4",
|
|
26
|
-
"mailparser": "^3.6.
|
|
26
|
+
"mailparser": "^3.6.9",
|
|
27
27
|
"node-imap": "^0.9.6"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -31,24 +31,24 @@
|
|
|
31
31
|
"@alcalzone/release-script-plugin-iobroker": "^3.7.0",
|
|
32
32
|
"@alcalzone/release-script-plugin-license": "^3.7.0",
|
|
33
33
|
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
|
|
34
|
-
"@iobroker/adapter-dev": "^1.
|
|
34
|
+
"@iobroker/adapter-dev": "^1.3.0",
|
|
35
35
|
"@iobroker/testing": "^4.1.0",
|
|
36
36
|
"@tsconfig/node16": "^16.1.1",
|
|
37
37
|
"@types/chai": "^4.3.11",
|
|
38
38
|
"@types/chai-as-promised": "^7.1.8",
|
|
39
39
|
"@types/imap": "^0.8.40",
|
|
40
40
|
"@types/mocha": "^10.0.6",
|
|
41
|
-
"@types/node": "^20.
|
|
41
|
+
"@types/node": "^20.11.24",
|
|
42
42
|
"@types/proxyquire": "^1.3.31",
|
|
43
|
-
"@types/sinon": "^17.0.
|
|
43
|
+
"@types/sinon": "^17.0.3",
|
|
44
44
|
"@types/sinon-chai": "^3.2.12",
|
|
45
|
-
"chai": "^4.
|
|
45
|
+
"chai": "^4.4.1",
|
|
46
46
|
"chai-as-promised": "^7.1.1",
|
|
47
|
-
"eslint": "^8.
|
|
47
|
+
"eslint": "^8.57.0",
|
|
48
48
|
"eslint-config-prettier": "^9.1.0",
|
|
49
49
|
"eslint-plugin-prettier": "^5.1.2",
|
|
50
50
|
"mocha": "^10.2.0",
|
|
51
|
-
"prettier": "^3.
|
|
51
|
+
"prettier": "^3.2.4",
|
|
52
52
|
"proxyquire": "^2.1.3",
|
|
53
53
|
"sinon": "^17.0.1",
|
|
54
54
|
"sinon-chai": "^3.7.0",
|