iobroker.imap 0.1.1 → 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/LICENSE +1 -1
- package/README.md +17 -4
- package/admin/blockly.js +22 -1
- package/io-package.json +27 -27
- package/lib/Connection.js +9 -6
- package/lib/imap_event.js +32 -7
- package/lib/translator.js +13 -0
- package/main.js +36 -12
- package/package.json +23 -23
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2023 Lucky-ESA <github@luckyskills.de>
|
|
3
|
+
Copyright (c) 2023-2024 Lucky-ESA <github@luckyskills.de>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
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,18 @@
|
|
|
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
|
+
|
|
65
|
+
### 0.1.2 (2024-01-24)
|
|
66
|
+
|
|
67
|
+
- (Lucky-ESA) Added missing translate
|
|
68
|
+
- (Lucky-ESA) Updated package
|
|
69
|
+
- (Lucky-ESA) Bug fixes
|
|
70
|
+
|
|
58
71
|
### 0.1.1 (2023-09-11)
|
|
59
72
|
|
|
60
73
|
- (Lucky-ESA) Delete wrong error parse message
|
|
@@ -123,7 +136,7 @@
|
|
|
123
136
|
|
|
124
137
|
MIT License
|
|
125
138
|
|
|
126
|
-
Copyright (c) 2023 Lucky-ESA <github@luckyskills.de>
|
|
139
|
+
Copyright (c) 2023-2024 Lucky-ESA <github@luckyskills.de>
|
|
127
140
|
|
|
128
141
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
129
142
|
of this software and associated documentation files (the "Software"), to deal
|
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"))
|
|
@@ -598,7 +613,11 @@ Blockly.JavaScript["imap_request"] = function (block) {
|
|
|
598
613
|
var value_bodie = Blockly.JavaScript.valueToCode(block, "BODIES", Blockly.JavaScript.ORDER_ATOMIC);
|
|
599
614
|
var value_max = Blockly.JavaScript.valueToCode(block, "MAX", Blockly.JavaScript.ORDER_ATOMIC);
|
|
600
615
|
var value_parse = block.getFieldValue("MAILPARSER");
|
|
601
|
-
|
|
616
|
+
if (value_parse === "TRUE" || value_parse === "true" || value_parse === true) {
|
|
617
|
+
value_parse = true;
|
|
618
|
+
} else {
|
|
619
|
+
value_parse = false;
|
|
620
|
+
}
|
|
602
621
|
|
|
603
622
|
var para_fetch = "";
|
|
604
623
|
if (value_fetch !== null && value_fetch !== "") {
|
|
@@ -683,6 +702,7 @@ Blockly.Blocks["imap_data"] = {
|
|
|
683
702
|
}
|
|
684
703
|
}
|
|
685
704
|
}
|
|
705
|
+
if (Object.keys(options_instance).length == 0) options_instance.push([Blockly.Translate("no_instance_found"), ""]);
|
|
686
706
|
|
|
687
707
|
this.appendDummyInput("INSTANCE")
|
|
688
708
|
.appendField(Blockly.Translate("imap"))
|
|
@@ -808,6 +828,7 @@ Blockly.Blocks["imap_flag"] = {
|
|
|
808
828
|
}
|
|
809
829
|
}
|
|
810
830
|
}
|
|
831
|
+
if (Object.keys(options_instance).length == 0) options_instance.push([Blockly.Translate("no_instance_found"), ""]);
|
|
811
832
|
|
|
812
833
|
this.appendDummyInput("INSTANCE")
|
|
813
834
|
.appendField(Blockly.Translate("imap"))
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
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
|
+
},
|
|
19
|
+
"0.1.2": {
|
|
20
|
+
"en": "Added missing translate\nUpdated package\nBug fixes",
|
|
21
|
+
"de": "Hinzugefügt fehlende Übersetzung\nAktualisiertes Paket\nFehlerbehebungen",
|
|
22
|
+
"ru": "Добавить недостающий перевод\nОбновленный пакет\nЗапястья",
|
|
23
|
+
"pt": "Adicionado em falta traduzir\nPacote atualizado\nCorreções de bugs",
|
|
24
|
+
"nl": "Toegevoegde ontbrekende vertaling\nBijgewerkt pakket\nBugfixes",
|
|
25
|
+
"fr": "Ajoutée manquante traduire\nPaquet mis à jour\nCorrections des bogues",
|
|
26
|
+
"it": "Aggiunto traduttore mancante\nPacchetto aggiornato\nCorrezioni di bug",
|
|
27
|
+
"es": "Traducir desaparecido\nPaquete actualizado\nCorrección de errores",
|
|
28
|
+
"pl": "Dodano brak tłumaczenia\nAktualizacja pakietu\nPoprawki błędów",
|
|
29
|
+
"uk": "Додати відсутній переклад\nОновлений пакет\nВиправлення помилок",
|
|
30
|
+
"zh-cn": "缺少翻译\n更新软件包\n错误修正"
|
|
31
|
+
},
|
|
6
32
|
"0.1.1": {
|
|
7
33
|
"en": "Delete wrong error parse message",
|
|
8
34
|
"de": "Falsche Fehlermeldung löschen",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
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",
|
|
68
94
|
"uk": "Фіксувати правильну лічильник для видимих і невидимих\nДодаткові можливості\nЗміни критерії без перезапуску\nEnglish, Українська, Français..\nДодано Connection.js від Module до адаптера\nВиправлення помилок",
|
|
69
95
|
"zh-cn": "Fix 纠正被发现和无见的反击\n增加能力\n2. 标准改变,而不恢复原状\n增加前景\nA. 添加了Anection.js from Module to Adapter\nBug fix"
|
|
70
|
-
},
|
|
71
|
-
"0.0.6": {
|
|
72
|
-
"en": "Added trigger move or copy emails\nAdded JSON for multiple IMAP accounts\nBug fixes",
|
|
73
|
-
"de": "Trigger-Bewegung oder Kopie-E-Mails hinzugefügt\nJSON für mehrere IMAP-Konten hinzugefügt\nFehlerbehebungen",
|
|
74
|
-
"ru": "Добавлены триггеры или копировать электронные письма\nДобавлен JSON для нескольких учетных записей IMAP\nИсправления ошибок",
|
|
75
|
-
"pt": "Adicionado movimento do gatilho ou copiar e-mails\nAdicionado JSON para múltiplas contas IMAP\nCorreções de bugs",
|
|
76
|
-
"nl": "Verplaatsing of mails\n_\nBug repareert",
|
|
77
|
-
"fr": "Ajout d'un déménagement ou d'une copie des courriels\nJSON ajouté pour plusieurs comptes IMAP\nCorrections",
|
|
78
|
-
"it": "Aggiunta di attivazione spostare o copiare e-mail\nAggiunto JSON per più account IMAP\nCorrezioni di bug",
|
|
79
|
-
"es": "Añadido movimiento de gatillo o copiar correos electrónicos\nAñadido JSON para múltiples cuentas de IMAP\nCorrección de errores",
|
|
80
|
-
"pl": "Added trigger move lub copy mail\nAdded JSON dla wielu kont IMAP\nBug",
|
|
81
|
-
"uk": "Доданий тригер переміщення або копіювання електронних листів\nДодано JSON для декількох облікових записів IMAP\nВиправлення помилок",
|
|
82
|
-
"zh-cn": "增购机或邮票\n增聘联合办多管方案账户\nBug fix"
|
|
83
|
-
},
|
|
84
|
-
"0.0.5": {
|
|
85
|
-
"en": "(Lucky-ESA) Added: Added move or copy\n(Lucky-ESA) Added: Set flag with datapoints",
|
|
86
|
-
"de": "(Lucky-ESA) Hinzugefügt: hinzugefügt verschieben oder kopieren\n(Lucky-ESA) Hinzugefügt: Flagge mit Datenpunkten festlegen",
|
|
87
|
-
"ru": "(Lucky-ESA) Добавлена: Добавлен ход или копия\n(Lucky-ESA) Добавлена: Установите флаг с точками данных",
|
|
88
|
-
"pt": "(Lucky-ESA) Adicionado: Adicionado movimento ou cópia\n(Lucky-ESA) Adicionado: Definir bandeira com datapoints",
|
|
89
|
-
"nl": "(Lucky-ESA) Toegevoegd\n(Lucky-ESA) Toegevoegd: Zet vlag met datapoints",
|
|
90
|
-
"fr": "(Lucky-ESA) Ajouté : Ajout d'un mouvement ou d'une copie\n(Lucky-ESA) Ajouté : Définir le drapeau avec des points de données",
|
|
91
|
-
"it": "(Lucky-ESA) Aggiunto: Aggiunto movimento o copia\n(Lucky-ESA) Aggiunto: Impostare la bandiera con i datapoint",
|
|
92
|
-
"es": "(Lucky-ESA) Añadido: Añadido movimiento o copia\n(Lucky-ESA) Añadido: Establecer bandera con puntos de datos",
|
|
93
|
-
"pl": "(Lucky-ESA) (ang.). Addition: Added movement or copy copy copy copy copy\n(Lucky-ESA) (ang.). Added: Ustanowić flagę z punktami danych",
|
|
94
|
-
"uk": "(Lucky-ESA) Доданий: Додано переміщення або копіювання\n(Lucky-ESA) Доданий: Настроювання прапора з точками даних",
|
|
95
|
-
"zh-cn": "(Lucky-ESA) 增 编:\n(Lucky-ESA) 增加: 数据点的旗帜"
|
|
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/lib/translator.js
CHANGED
|
@@ -2664,4 +2664,17 @@ exports.trans = {
|
|
|
2664
2664
|
uk: "Можлива максимальна кількість 100 електронних листів.",
|
|
2665
2665
|
"zh-cn": "可能有100个电子邮件。.",
|
|
2666
2666
|
},
|
|
2667
|
+
"Missing fetch": {
|
|
2668
|
+
en: "Missing fetch",
|
|
2669
|
+
de: "Fehlende Fetch",
|
|
2670
|
+
ru: "Отсутствующий забор",
|
|
2671
|
+
pt: "Missing fetch",
|
|
2672
|
+
nl: "Vermist Fetch",
|
|
2673
|
+
fr: "Missing fetch",
|
|
2674
|
+
it: "Presa mancante",
|
|
2675
|
+
es: "Desaparecido",
|
|
2676
|
+
pl: "Missing fetch",
|
|
2677
|
+
uk: "М'ясо курча",
|
|
2678
|
+
"zh-cn": "失踪",
|
|
2679
|
+
},
|
|
2667
2680
|
};
|
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;
|
|
@@ -252,13 +256,19 @@ class Imap extends utils.Adapter {
|
|
|
252
256
|
await this.createSelect(selectbox);
|
|
253
257
|
this.log_translator("info", "IMAP check start");
|
|
254
258
|
await this.checkDeviceFolder();
|
|
255
|
-
this.qualityInterval = this.setInterval(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
this.qualityInterval = this.setInterval(
|
|
260
|
+
() => {
|
|
261
|
+
this.cleanupQuality();
|
|
262
|
+
this.memrsscheck();
|
|
263
|
+
},
|
|
264
|
+
60 * 60 * 24 * 1000,
|
|
265
|
+
);
|
|
266
|
+
this.statusInterval = this.setInterval(
|
|
267
|
+
() => {
|
|
268
|
+
this.connectionCheck();
|
|
269
|
+
},
|
|
270
|
+
60 * 60 * 1000,
|
|
271
|
+
);
|
|
262
272
|
this.cleanupQuality();
|
|
263
273
|
this.checksupport();
|
|
264
274
|
this.subscribeStates(`json_imap`);
|
|
@@ -1064,13 +1074,17 @@ class Imap extends utils.Adapter {
|
|
|
1064
1074
|
obj.message["search"] != "" &&
|
|
1065
1075
|
obj.message["name"] != "" &&
|
|
1066
1076
|
obj.message["bodie"] != "" &&
|
|
1067
|
-
obj.message["parse"] !=
|
|
1077
|
+
obj.message["parse"] != null &&
|
|
1068
1078
|
obj.message["max"] > 0 &&
|
|
1069
1079
|
obj.message["max"] < 100
|
|
1070
1080
|
) {
|
|
1071
1081
|
if (obj.message["name"] !== "all") {
|
|
1072
1082
|
const user = obj.message["name"].replace(FORBIDDEN_CHARS, "_");
|
|
1073
|
-
|
|
1083
|
+
try {
|
|
1084
|
+
this.custom_search(user, _obj);
|
|
1085
|
+
} catch (e) {
|
|
1086
|
+
this.sendTo(obj.from, obj.command, [], obj.callback);
|
|
1087
|
+
}
|
|
1074
1088
|
} else {
|
|
1075
1089
|
this.log_translator("info", "No IMAP selected");
|
|
1076
1090
|
this.sendTo(obj.from, obj.command, [], obj.callback);
|
|
@@ -1175,12 +1189,14 @@ class Imap extends utils.Adapter {
|
|
|
1175
1189
|
onUnload(callback) {
|
|
1176
1190
|
try {
|
|
1177
1191
|
for (const dev of this.clientsID) {
|
|
1192
|
+
this.clientsRaw[dev].onExpungeTimer && this.clearTimeout(this.clientsRaw[dev].onExpungeTimer);
|
|
1178
1193
|
this.clients[dev] = null;
|
|
1179
1194
|
this.restartIMAPConnection[dev] && this.clearTimeout(this.restartIMAPConnection[dev]);
|
|
1180
1195
|
this.setState(`${dev}.online`, {
|
|
1181
1196
|
val: false,
|
|
1182
1197
|
ack: true,
|
|
1183
1198
|
});
|
|
1199
|
+
this.clientsRaw[dev] = null;
|
|
1184
1200
|
}
|
|
1185
1201
|
this.qualityInterval && this.clearInterval(this.qualityInterval);
|
|
1186
1202
|
this.statusInterval && this.clearInterval(this.statusInterval);
|
|
@@ -1268,6 +1284,14 @@ class Imap extends utils.Adapter {
|
|
|
1268
1284
|
this.setAckFlag(id);
|
|
1269
1285
|
return;
|
|
1270
1286
|
}
|
|
1287
|
+
if (command === "set") {
|
|
1288
|
+
this.setAckFlag(id);
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
if (command === "type") {
|
|
1292
|
+
this.setAckFlag(id);
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1271
1295
|
if (command === "folder") {
|
|
1272
1296
|
this.setAckFlag(id);
|
|
1273
1297
|
return;
|
|
@@ -1391,15 +1415,15 @@ class Imap extends utils.Adapter {
|
|
|
1391
1415
|
*/
|
|
1392
1416
|
async applyFlag(clientID, set, uid, type) {
|
|
1393
1417
|
if (this.clients[clientID]) {
|
|
1394
|
-
if (set == "") {
|
|
1418
|
+
if (set == "" || set == null) {
|
|
1395
1419
|
const sets = await this.getStateAsync(`${clientID}.remote.flag.set`);
|
|
1396
1420
|
set = sets && sets.val ? sets.val.toString() : "";
|
|
1397
1421
|
}
|
|
1398
|
-
if (uid === 0) {
|
|
1422
|
+
if (uid === 0 || uid == null) {
|
|
1399
1423
|
const uids = await this.getStateAsync(`${clientID}.remote.flag.uid`);
|
|
1400
1424
|
uid = uids && uids.val != null ? Number(uids.val) : 0;
|
|
1401
1425
|
}
|
|
1402
|
-
if (type == "") {
|
|
1426
|
+
if (type == "" || type == null) {
|
|
1403
1427
|
const types = await this.getStateAsync(`${clientID}.remote.flag.type`);
|
|
1404
1428
|
type = types && types.val ? types.val.toString() : "";
|
|
1405
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",
|
|
@@ -22,37 +22,37 @@
|
|
|
22
22
|
"node": ">= 16"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@iobroker/adapter-core": "^3.0.
|
|
26
|
-
"mailparser": "^3.6.
|
|
25
|
+
"@iobroker/adapter-core": "^3.0.4",
|
|
26
|
+
"mailparser": "^3.6.9",
|
|
27
27
|
"node-imap": "^0.9.6"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@alcalzone/release-script": "^3.
|
|
31
|
-
"@alcalzone/release-script-plugin-iobroker": "^3.
|
|
32
|
-
"@alcalzone/release-script-plugin-license": "^3.
|
|
33
|
-
"@alcalzone/release-script-plugin-manual-review": "^3.
|
|
34
|
-
"@iobroker/adapter-dev": "^1.
|
|
30
|
+
"@alcalzone/release-script": "^3.7.0",
|
|
31
|
+
"@alcalzone/release-script-plugin-iobroker": "^3.7.0",
|
|
32
|
+
"@alcalzone/release-script-plugin-license": "^3.7.0",
|
|
33
|
+
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
|
|
34
|
+
"@iobroker/adapter-dev": "^1.3.0",
|
|
35
35
|
"@iobroker/testing": "^4.1.0",
|
|
36
36
|
"@tsconfig/node16": "^16.1.1",
|
|
37
|
-
"@types/chai": "^4.3.
|
|
38
|
-
"@types/chai-as-promised": "^7.1.
|
|
39
|
-
"@types/imap": "^0.8.
|
|
40
|
-
"@types/mocha": "^10.0.
|
|
41
|
-
"@types/node": "^20.
|
|
42
|
-
"@types/proxyquire": "^1.3.
|
|
43
|
-
"@types/sinon": "^
|
|
44
|
-
"@types/sinon-chai": "^3.2.
|
|
45
|
-
"chai": "^4.
|
|
37
|
+
"@types/chai": "^4.3.11",
|
|
38
|
+
"@types/chai-as-promised": "^7.1.8",
|
|
39
|
+
"@types/imap": "^0.8.40",
|
|
40
|
+
"@types/mocha": "^10.0.6",
|
|
41
|
+
"@types/node": "^20.11.24",
|
|
42
|
+
"@types/proxyquire": "^1.3.31",
|
|
43
|
+
"@types/sinon": "^17.0.3",
|
|
44
|
+
"@types/sinon-chai": "^3.2.12",
|
|
45
|
+
"chai": "^4.4.1",
|
|
46
46
|
"chai-as-promised": "^7.1.1",
|
|
47
|
-
"eslint": "^8.
|
|
48
|
-
"eslint-config-prettier": "^
|
|
49
|
-
"eslint-plugin-prettier": "^
|
|
47
|
+
"eslint": "^8.57.0",
|
|
48
|
+
"eslint-config-prettier": "^9.1.0",
|
|
49
|
+
"eslint-plugin-prettier": "^5.1.2",
|
|
50
50
|
"mocha": "^10.2.0",
|
|
51
|
-
"prettier": "^2.
|
|
51
|
+
"prettier": "^3.2.4",
|
|
52
52
|
"proxyquire": "^2.1.3",
|
|
53
|
-
"sinon": "^
|
|
53
|
+
"sinon": "^17.0.1",
|
|
54
54
|
"sinon-chai": "^3.7.0",
|
|
55
|
-
"typescript": "~5.
|
|
55
|
+
"typescript": "~5.3.2"
|
|
56
56
|
},
|
|
57
57
|
"main": "main.js",
|
|
58
58
|
"files": [
|