iobroker.imap 0.0.7 → 0.0.9
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 +16 -3
- package/admin/blockly.js +4 -18
- package/admin/i18n/de/translations.json +21 -11
- package/admin/i18n/en/translations.json +11 -1
- package/admin/i18n/es/translations.json +12 -2
- package/admin/i18n/fr/translations.json +11 -1
- package/admin/i18n/it/translations.json +11 -1
- package/admin/i18n/nl/translations.json +11 -1
- package/admin/i18n/pl/translations.json +11 -1
- package/admin/i18n/pt/translations.json +11 -1
- package/admin/i18n/ru/translations.json +11 -1
- package/admin/i18n/uk/translations.json +11 -1
- package/admin/i18n/zh-cn/translations.json +12 -2
- package/admin/jsonConfig.json +69 -2
- package/io-package.json +34 -15
- package/lib/Connection.js +4 -2
- package/lib/imap_event.js +34 -14
- package/lib/translator.js +91 -13
- package/main.js +117 -23
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -37,10 +37,13 @@
|
|
|
37
37
|
- vodafone
|
|
38
38
|
- strato
|
|
39
39
|
|
|
40
|
-
## Description
|
|
40
|
+
## Description
|
|
41
41
|
|
|
42
|
-
🇬🇧 [Description](/docs/en/README.md)
|
|
43
|
-
|
|
42
|
+
🇬🇧 [Description](/docs/en/README.md)
|
|
43
|
+
|
|
44
|
+
## Questions
|
|
45
|
+
|
|
46
|
+
🇩🇪 [Fragen](https://forum.iobroker.net/topic/63400/test-adapter-iobroker-imap-v0-0-1-github)
|
|
44
47
|
|
|
45
48
|
## Changelog
|
|
46
49
|
|
|
@@ -48,6 +51,16 @@
|
|
|
48
51
|
Placeholder for the next version (at the beginning of the line):
|
|
49
52
|
### **WORK IN PROGRESS**
|
|
50
53
|
-->
|
|
54
|
+
### 0.0.9 (2023-07-26)
|
|
55
|
+
|
|
56
|
+
- (Lucky-ESA) Fixed RAM consumption of new emails
|
|
57
|
+
- (Lucky-ESA) Added counter attachments in JSON
|
|
58
|
+
|
|
59
|
+
### 0.0.8 (2023-07-13)
|
|
60
|
+
|
|
61
|
+
- (Lucky-ESA) Fix refresh crash
|
|
62
|
+
- (Lucky-ESA) Added MB threshold
|
|
63
|
+
|
|
51
64
|
### 0.0.7 (2023-04-25)
|
|
52
65
|
|
|
53
66
|
- (Lucky-ESA) Fix correct counter for seen and unseen
|
package/admin/blockly.js
CHANGED
|
@@ -457,7 +457,7 @@ Blockly.JavaScript["imap"] = function (block) {
|
|
|
457
457
|
var logText;
|
|
458
458
|
if (logLevel) {
|
|
459
459
|
logText =
|
|
460
|
-
"console." + logLevel +
|
|
460
|
+
"console." + logLevel + "(\"imap: " + value_max + " + " + value_name + "\");\n";
|
|
461
461
|
} else {
|
|
462
462
|
logText = "";
|
|
463
463
|
}
|
|
@@ -614,14 +614,7 @@ Blockly.JavaScript["imap_request"] = function (block) {
|
|
|
614
614
|
args.push('\n "parse": ' + value_parse);
|
|
615
615
|
var logText;
|
|
616
616
|
if (logLevel) {
|
|
617
|
-
logText =
|
|
618
|
-
"console." +
|
|
619
|
-
logLevel +
|
|
620
|
-
'("' +
|
|
621
|
-
dropdown_instance +
|
|
622
|
-
': " + "' +
|
|
623
|
-
(args.length ? args.join(",") + "\n" : "") +
|
|
624
|
-
'");\n';
|
|
617
|
+
logText = "console." + logLevel + "(\"imap_request: " + value_max + " + " + value_name + "\");\n";
|
|
625
618
|
} else {
|
|
626
619
|
logText = "";
|
|
627
620
|
}
|
|
@@ -736,14 +729,7 @@ Blockly.JavaScript["imap_data"] = function (block) {
|
|
|
736
729
|
args.push('\n "value": "' + value_value + '"');
|
|
737
730
|
var logText;
|
|
738
731
|
if (logLevel) {
|
|
739
|
-
logText =
|
|
740
|
-
"console." +
|
|
741
|
-
logLevel +
|
|
742
|
-
'("' +
|
|
743
|
-
dropdown_instance +
|
|
744
|
-
': " + "' +
|
|
745
|
-
(args.length ? args.join(",") + "\n" : "") +
|
|
746
|
-
'");\n';
|
|
732
|
+
logText = "console." + logLevel + "(\"imap_data: " + value_name + "\");\n";
|
|
747
733
|
} else {
|
|
748
734
|
logText = "";
|
|
749
735
|
}
|
|
@@ -856,7 +842,7 @@ Blockly.JavaScript["imap_flag"] = function (block) {
|
|
|
856
842
|
var logText;
|
|
857
843
|
if (logLevel) {
|
|
858
844
|
logText =
|
|
859
|
-
"console." + logLevel +
|
|
845
|
+
"console." + logLevel + "(\"imap_flag: " + value_flag + " + " + value_uid + " + " + value_name + "\");\n";
|
|
860
846
|
} else {
|
|
861
847
|
logText = "";
|
|
862
848
|
}
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
"activ": "Aktiv",
|
|
4
4
|
"ACTIV": "Host aktivieren",
|
|
5
5
|
"host": "Hostname",
|
|
6
|
-
"HOST": "Hostname (z.
|
|
7
|
-
"port": "
|
|
6
|
+
"HOST": "Hostname (z. B. imap.example.com oder example.com)",
|
|
7
|
+
"port": "Hafen",
|
|
8
8
|
"PORT": "Port (Standard: 993)",
|
|
9
|
-
"username": "
|
|
10
|
-
"USERNAME": "
|
|
9
|
+
"username": "Nutzername",
|
|
10
|
+
"USERNAME": "Nutzername",
|
|
11
11
|
"password": "Passwort",
|
|
12
12
|
"PASSWORD": "Passwort",
|
|
13
13
|
"max": "max.",
|
|
14
14
|
"MAX": "Wie viele E-Mails sollen als Datenpunkte angelegt werden?",
|
|
15
|
-
"max_html": "max.
|
|
15
|
+
"max_html": "max.",
|
|
16
16
|
"MAX_HTML": "Wie viele E-Mails sollen als HTML erstellt werden?",
|
|
17
|
-
"token": "
|
|
18
|
-
"TOKEN": "Token für
|
|
17
|
+
"token": "Zeichen",
|
|
18
|
+
"TOKEN": "Token für die xoauth2-Anmeldung",
|
|
19
19
|
"tls": "TLS",
|
|
20
20
|
"TLS": "TLS aktivieren",
|
|
21
21
|
"attach": "Att.",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"Tab icons": "Symbole erstellen",
|
|
44
44
|
"Info icons": "Ordnersymbol hochladen.",
|
|
45
45
|
"iconname": "Symbolname",
|
|
46
|
-
"ICONNAME": "Name des Symbols (z.
|
|
46
|
+
"ICONNAME": "Name des Symbols (z. B. Google Mail)",
|
|
47
47
|
"Tab Hosts": "IMAPs erstellen",
|
|
48
48
|
"icon64": "Symbol auswählen",
|
|
49
49
|
"ICON64": "Symbol auswählen",
|
|
50
50
|
"tls_option": "tls-Option",
|
|
51
51
|
"TLS_OPTION": "Options-Objekt, das an tls.connect() übergeben werden soll",
|
|
52
52
|
"auto_tls": "Auto-TLS",
|
|
53
|
-
"AUTO_TLS": "Auf
|
|
54
|
-
"Tab oauth": "
|
|
53
|
+
"AUTO_TLS": "Auf „immer“ setzen, um immer Verbindungs-Upgrades über STARTTLS zu versuchen, „erforderlich“, nur wenn ein Upgrade erforderlich ist, oder „nie“, um nie ein Upgrade zu versuchen.",
|
|
54
|
+
"Tab oauth": "Autorisieren Sie oauth2",
|
|
55
55
|
"Tab oauth2": "Login-oauth2-Daten",
|
|
56
56
|
"provider": "Anbieter",
|
|
57
57
|
"PROVIDER": "Anbieter",
|
|
@@ -62,5 +62,15 @@
|
|
|
62
62
|
"secureid": "Geheime ID",
|
|
63
63
|
"SECUREID": "Geheime ID",
|
|
64
64
|
"pathid": "Verzeichnis-ID",
|
|
65
|
-
"PATHID": "Verzeichnis-ID"
|
|
65
|
+
"PATHID": "Verzeichnis-ID",
|
|
66
|
+
"MAX_MB": "max. MEMRSS-Limit für einen Adapterneustart (100-600 MB - 24h-Check)",
|
|
67
|
+
"objectId": "Objekt Identifikation",
|
|
68
|
+
"telegram_user": "Instanz Benutzer",
|
|
69
|
+
"telegram_user_tooltip": "Instanz Benutzer (Mehrere durch Komma trennen - z. B. Peter, Olaf)",
|
|
70
|
+
"telegram": "Instanzen",
|
|
71
|
+
"selection": "Auswahl",
|
|
72
|
+
"TELEGRAM": "Senden",
|
|
73
|
+
"RESTART": "Neu starten",
|
|
74
|
+
"DATAPOINT": "Datenpunkt",
|
|
75
|
+
"telegram_tooltip": "Instanz (Mehrere durch Komma trennen - z. B. Telegramm.0, Telegramm.1)"
|
|
66
76
|
}
|
|
@@ -62,5 +62,15 @@
|
|
|
62
62
|
"secureid": "Secret ID",
|
|
63
63
|
"SECUREID": "Secret ID",
|
|
64
64
|
"pathid": "Directory ID",
|
|
65
|
-
"PATHID": "Directory ID"
|
|
65
|
+
"PATHID": "Directory ID",
|
|
66
|
+
"MAX_MB": "Max. MEMRSS limit for an adapter restart (100-600 MB - 24h check)",
|
|
67
|
+
"objectId": "Object-ID",
|
|
68
|
+
"telegram_user": "Instance User",
|
|
69
|
+
"telegram_user_tooltip": "Instance User (separate multiples with a comma - e.g. Peter, Olaf)",
|
|
70
|
+
"telegram": "Instance",
|
|
71
|
+
"selection": "Selection",
|
|
72
|
+
"TELEGRAM": "Send",
|
|
73
|
+
"RESTART": "Restart",
|
|
74
|
+
"DATAPOINT": "Datapoint",
|
|
75
|
+
"telegram_tooltip": "Instance (separate multiples with a comma - e.g. telegram.0, telegram.1)"
|
|
66
76
|
}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"ATTACH": "Accesorio de carga",
|
|
23
23
|
"upload": "ICONO",
|
|
24
24
|
"UPLOAD": "icono de carpeta",
|
|
25
|
-
"flag": "
|
|
25
|
+
"flag": "Banderas",
|
|
26
26
|
"FLAG": "Elija Banderas (por ejemplo, TODAS para todos los correos electrónicos)",
|
|
27
27
|
"ALL": "todo",
|
|
28
28
|
"ANSWERED": "contestada",
|
|
@@ -62,5 +62,15 @@
|
|
|
62
62
|
"secureid": "identificación secreta",
|
|
63
63
|
"SECUREID": "identificación secreta",
|
|
64
64
|
"pathid": "Id. de directorio",
|
|
65
|
-
"PATHID": "Id. de directorio"
|
|
65
|
+
"PATHID": "Id. de directorio",
|
|
66
|
+
"MAX_MB": "máx. Límite de MEMRSS para un reinicio del adaptador (100-600 MB - verificación de 24 horas)",
|
|
67
|
+
"objectId": "ID de objeto",
|
|
68
|
+
"telegram_user": "Usuario de instancia",
|
|
69
|
+
"telegram_user_tooltip": "Usuario de instancia (separe los múltiplos con una coma, por ejemplo, Peter, Olaf)",
|
|
70
|
+
"telegram": "Instancia",
|
|
71
|
+
"selection": "Selección",
|
|
72
|
+
"TELEGRAM": "Enviar",
|
|
73
|
+
"RESTART": "Reanudar",
|
|
74
|
+
"DATAPOINT": "Punto de datos",
|
|
75
|
+
"telegram_tooltip": "Instancia (separe los múltiplos con una coma, por ejemplo, telegram.0, telegram.1)"
|
|
66
76
|
}
|
|
@@ -62,5 +62,15 @@
|
|
|
62
62
|
"secureid": "ID secret",
|
|
63
63
|
"SECUREID": "ID secret",
|
|
64
64
|
"pathid": "ID de répertoire",
|
|
65
|
-
"PATHID": "ID de répertoire"
|
|
65
|
+
"PATHID": "ID de répertoire",
|
|
66
|
+
"MAX_MB": "Max. Limite MEMRSS pour un redémarrage de l'adaptateur (100-600 Mo - vérification 24h)",
|
|
67
|
+
"objectId": "ID d'objet",
|
|
68
|
+
"telegram_user": "Utilisateur d'instance",
|
|
69
|
+
"telegram_user_tooltip": "Utilisateur d'instance (séparez les multiples par une virgule - par exemple, Peter, Olaf)",
|
|
70
|
+
"telegram": "Exemple",
|
|
71
|
+
"selection": "Sélection",
|
|
72
|
+
"TELEGRAM": "Envoyer",
|
|
73
|
+
"RESTART": "Redémarrage",
|
|
74
|
+
"DATAPOINT": "Point de données",
|
|
75
|
+
"telegram_tooltip": "Instance (séparez les multiples par une virgule - par exemple telegram.0, telegram.1)"
|
|
66
76
|
}
|
|
@@ -62,5 +62,15 @@
|
|
|
62
62
|
"secureid": "ID segreto",
|
|
63
63
|
"SECUREID": "ID segreto",
|
|
64
64
|
"pathid": "ID rubrica",
|
|
65
|
-
"PATHID": "ID rubrica"
|
|
65
|
+
"PATHID": "ID rubrica",
|
|
66
|
+
"MAX_MB": "Massimo. Limite MEMRSS per il riavvio di un adattatore (100-600 MB - controllo 24 ore)",
|
|
67
|
+
"objectId": "ID oggetto",
|
|
68
|
+
"telegram_user": "Utente istanza",
|
|
69
|
+
"telegram_user_tooltip": "Utente istanza (separa i multipli con una virgola, ad esempio Peter, Olaf)",
|
|
70
|
+
"telegram": "Esempio",
|
|
71
|
+
"selection": "Selezione",
|
|
72
|
+
"TELEGRAM": "Inviare",
|
|
73
|
+
"RESTART": "Ricomincia",
|
|
74
|
+
"DATAPOINT": "Punto dati",
|
|
75
|
+
"telegram_tooltip": "Istanza (separare i multipli con una virgola - ad es. telegramma.0, telegramma.1)"
|
|
66
76
|
}
|
|
@@ -62,5 +62,15 @@
|
|
|
62
62
|
"secureid": "Geheime ID",
|
|
63
63
|
"SECUREID": "Geheime ID",
|
|
64
64
|
"pathid": "Directory-ID",
|
|
65
|
-
"PATHID": "Directory-ID"
|
|
65
|
+
"PATHID": "Directory-ID",
|
|
66
|
+
"MAX_MB": "Max. MEMRSS-limiet voor het opnieuw opstarten van een adapter (100-600 MB - 24-uurs controle)",
|
|
67
|
+
"objectId": "Object-ID",
|
|
68
|
+
"telegram_user": "Instantie Gebruiker",
|
|
69
|
+
"telegram_user_tooltip": "Instantiegebruiker (scheid veelvouden met een komma - bijv. Peter, Olaf)",
|
|
70
|
+
"telegram": "Voorbeeld",
|
|
71
|
+
"selection": "Selectie",
|
|
72
|
+
"TELEGRAM": "Versturen",
|
|
73
|
+
"RESTART": "Herstarten",
|
|
74
|
+
"DATAPOINT": "Data punt",
|
|
75
|
+
"telegram_tooltip": "Instantie (scheid veelvouden met een komma - bijv. telegram.0, telegram.1)"
|
|
66
76
|
}
|
|
@@ -62,5 +62,15 @@
|
|
|
62
62
|
"secureid": "Tajny identyfikator",
|
|
63
63
|
"SECUREID": "Tajny identyfikator",
|
|
64
64
|
"pathid": "Identyfikator katalogu",
|
|
65
|
-
"PATHID": "Identyfikator katalogu"
|
|
65
|
+
"PATHID": "Identyfikator katalogu",
|
|
66
|
+
"MAX_MB": "Maks. Limit MEMRSS dla ponownego uruchomienia adaptera (100-600 MB - sprawdzanie 24h)",
|
|
67
|
+
"objectId": "Identyfikator obiektu",
|
|
68
|
+
"telegram_user": "Użytkownik instancji",
|
|
69
|
+
"telegram_user_tooltip": "Użytkownik instancji (oddziel wielokrotności przecinkiem - np. Piotr, Olaf)",
|
|
70
|
+
"telegram": "Instancja",
|
|
71
|
+
"selection": "Wybór",
|
|
72
|
+
"TELEGRAM": "Wysłać",
|
|
73
|
+
"RESTART": "Uruchom ponownie",
|
|
74
|
+
"DATAPOINT": "Punkt danych",
|
|
75
|
+
"telegram_tooltip": "Instancja (oddziel wielokrotności przecinkiem - np. telegram.0, telegram.1)"
|
|
66
76
|
}
|
|
@@ -62,5 +62,15 @@
|
|
|
62
62
|
"secureid": "ID secreto",
|
|
63
63
|
"SECUREID": "ID secreto",
|
|
64
64
|
"pathid": "ID do diretório",
|
|
65
|
-
"PATHID": "ID do diretório"
|
|
65
|
+
"PATHID": "ID do diretório",
|
|
66
|
+
"MAX_MB": "máx. Limite de MEMRSS para uma reinicialização do adaptador (100-600 MB - verificação de 24 horas)",
|
|
67
|
+
"objectId": "ID do objeto",
|
|
68
|
+
"telegram_user": "Usuário da instância",
|
|
69
|
+
"telegram_user_tooltip": "Usuário da instância (separe os múltiplos com uma vírgula - por exemplo, Peter, Olaf)",
|
|
70
|
+
"telegram": "Instância",
|
|
71
|
+
"selection": "Seleção",
|
|
72
|
+
"TELEGRAM": "Enviar",
|
|
73
|
+
"RESTART": "Reiniciar",
|
|
74
|
+
"DATAPOINT": "Ponto de dados",
|
|
75
|
+
"telegram_tooltip": "Instância (separe os múltiplos com uma vírgula - por exemplo, telegram.0, telegram.1)"
|
|
66
76
|
}
|
|
@@ -62,5 +62,15 @@
|
|
|
62
62
|
"secureid": "Секретный идентификатор",
|
|
63
63
|
"SECUREID": "Секретный идентификатор",
|
|
64
64
|
"pathid": "Идентификатор каталога",
|
|
65
|
-
"PATHID": "Идентификатор каталога"
|
|
65
|
+
"PATHID": "Идентификатор каталога",
|
|
66
|
+
"MAX_MB": "Макс. Лимит MEMRSS для перезапуска адаптера (100-600 МБ - проверка 24 часа)",
|
|
67
|
+
"objectId": "Идентификатор объекта",
|
|
68
|
+
"telegram_user": "Пользователь экземпляра",
|
|
69
|
+
"telegram_user_tooltip": "Пользователь экземпляра (разделяйте несколько запятыми — например, Питер, Олаф)",
|
|
70
|
+
"telegram": "Пример",
|
|
71
|
+
"selection": "Выбор",
|
|
72
|
+
"TELEGRAM": "Отправлять",
|
|
73
|
+
"RESTART": "Перезапуск",
|
|
74
|
+
"DATAPOINT": "Точка данных",
|
|
75
|
+
"telegram_tooltip": "Экземпляр (разделяйте кратные запятой - например, телеграмма.0, телеграмма.1)"
|
|
66
76
|
}
|
|
@@ -62,5 +62,15 @@
|
|
|
62
62
|
"secureid": "Секретний ідентифікатор",
|
|
63
63
|
"SECUREID": "Секретний ідентифікатор",
|
|
64
64
|
"pathid": "Ідентифікатор каталогу",
|
|
65
|
-
"PATHID": "Ідентифікатор каталогу"
|
|
65
|
+
"PATHID": "Ідентифікатор каталогу",
|
|
66
|
+
"MAX_MB": "Макс. Обмеження MEMRSS для перезавантаження адаптера (100-600 МБ - 24 години перевірки)",
|
|
67
|
+
"objectId": "Object-ID",
|
|
68
|
+
"telegram_user": "Користувач екземпляра",
|
|
69
|
+
"telegram_user_tooltip": "Користувач екземпляра (розділяйте кратні комами, наприклад, Peter, Olaf)",
|
|
70
|
+
"telegram": "Екземпляр",
|
|
71
|
+
"selection": "Вибір",
|
|
72
|
+
"TELEGRAM": "Надіслати",
|
|
73
|
+
"RESTART": "Перезапустіть",
|
|
74
|
+
"DATAPOINT": "Точка даних",
|
|
75
|
+
"telegram_tooltip": "Екземпляр (розділяйте кратні комами, наприклад, telegram.0, telegram.1)"
|
|
66
76
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"max": "最大限度。",
|
|
14
14
|
"MAX": "应创建多少封电子邮件作为数据点?",
|
|
15
15
|
"max_html": "最大限度。",
|
|
16
|
-
"MAX_HTML": "
|
|
16
|
+
"MAX_HTML": "应将多少电子邮件创建为 HTML?",
|
|
17
17
|
"token": "代币",
|
|
18
18
|
"TOKEN": "xoauth2 登录的令牌",
|
|
19
19
|
"tls": "TLS",
|
|
@@ -62,5 +62,15 @@
|
|
|
62
62
|
"secureid": "密码",
|
|
63
63
|
"SECUREID": "密码",
|
|
64
64
|
"pathid": "目录编号",
|
|
65
|
-
"PATHID": "目录编号"
|
|
65
|
+
"PATHID": "目录编号",
|
|
66
|
+
"MAX_MB": "最大限度。适配器重启的 MEMRSS 限制(100-600 MB - 24 小时检查)",
|
|
67
|
+
"objectId": "对象ID",
|
|
68
|
+
"telegram_user": "实例用户",
|
|
69
|
+
"telegram_user_tooltip": "实例用户(用逗号分隔倍数 - 例如 Peter, Olaf)",
|
|
70
|
+
"telegram": "实例",
|
|
71
|
+
"selection": "选择",
|
|
72
|
+
"TELEGRAM": "发送",
|
|
73
|
+
"RESTART": "重新开始",
|
|
74
|
+
"DATAPOINT": "数据点",
|
|
75
|
+
"telegram_tooltip": "实例(用逗号分隔倍数 - 例如 telegram.0, telegram.1)"
|
|
66
76
|
}
|
package/admin/jsonConfig.json
CHANGED
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"width": 60,
|
|
103
103
|
"title": "max",
|
|
104
104
|
"tooltip": "MAX",
|
|
105
|
-
"min":
|
|
105
|
+
"min": 1,
|
|
106
106
|
"max": 99,
|
|
107
107
|
"filter": false,
|
|
108
108
|
"sort": false,
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"width": 60,
|
|
119
119
|
"title": "max_html",
|
|
120
120
|
"tooltip": "MAX_HTML",
|
|
121
|
-
"min":
|
|
121
|
+
"min": 1,
|
|
122
122
|
"max": 99,
|
|
123
123
|
"filter": false,
|
|
124
124
|
"sort": false,
|
|
@@ -234,6 +234,73 @@
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
]
|
|
237
|
+
},
|
|
238
|
+
"dividerafterdevice": {
|
|
239
|
+
"newLine": true,
|
|
240
|
+
"type": "divider"
|
|
241
|
+
},
|
|
242
|
+
"max_mb": {
|
|
243
|
+
"type": "number",
|
|
244
|
+
"newLine": true,
|
|
245
|
+
"sm": 3,
|
|
246
|
+
"label": "MAX_MB",
|
|
247
|
+
"default": 400,
|
|
248
|
+
"min": 100,
|
|
249
|
+
"max": 600,
|
|
250
|
+
"step": 1
|
|
251
|
+
},
|
|
252
|
+
"max_mb_selection": {
|
|
253
|
+
"type": "select",
|
|
254
|
+
"newLine": true,
|
|
255
|
+
"sm": 12,
|
|
256
|
+
"md": 6,
|
|
257
|
+
"lg": 3,
|
|
258
|
+
"label": "selection",
|
|
259
|
+
"default": 2,
|
|
260
|
+
"options": [
|
|
261
|
+
{ "label": "TELEGRAM", "value": 1 },
|
|
262
|
+
{ "label": "RESTART", "value": 2 },
|
|
263
|
+
{ "label": "DATAPOINT", "value": 3 }
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
"max_mb_telegram": {
|
|
267
|
+
"newLine": true,
|
|
268
|
+
"type": "text",
|
|
269
|
+
"label": "telegram",
|
|
270
|
+
"tooltip": "telegram_tooltip",
|
|
271
|
+
"disabled": "data.max_mb_selection !== 1",
|
|
272
|
+
"hidden": "data.max_mb_selection !== 1",
|
|
273
|
+
"hideOnlyControl": false,
|
|
274
|
+
"sm": 12,
|
|
275
|
+
"md": 6,
|
|
276
|
+
"lg": 3,
|
|
277
|
+
"adapter": "telegram",
|
|
278
|
+
"default": ""
|
|
279
|
+
},
|
|
280
|
+
"max_mb_telegram_user": {
|
|
281
|
+
"newLine": true,
|
|
282
|
+
"type": "text",
|
|
283
|
+
"label": "telegram_user",
|
|
284
|
+
"tooltip": "telegram_user_tooltip",
|
|
285
|
+
"disabled": "data.max_mb_selection !== 1",
|
|
286
|
+
"hidden": "data.max_mb_selection !== 1",
|
|
287
|
+
"hideOnlyControl": false,
|
|
288
|
+
"sm": 12,
|
|
289
|
+
"md": 6,
|
|
290
|
+
"lg": 3,
|
|
291
|
+
"default": ""
|
|
292
|
+
},
|
|
293
|
+
"max_mb_object": {
|
|
294
|
+
"newLine": true,
|
|
295
|
+
"type": "objectId",
|
|
296
|
+
"label": "objectId",
|
|
297
|
+
"disabled": "data.max_mb_selection !== 3",
|
|
298
|
+
"hidden": "data.max_mb_selection !== 3",
|
|
299
|
+
"hideOnlyControl": false,
|
|
300
|
+
"sm": 12,
|
|
301
|
+
"md": 6,
|
|
302
|
+
"lg": 3,
|
|
303
|
+
"default": ""
|
|
237
304
|
}
|
|
238
305
|
}
|
|
239
306
|
},
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "imap",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.0.9": {
|
|
7
|
+
"en": "Fixed RAM consumption of new emails\nAdded counter attachments in JSON",
|
|
8
|
+
"de": "Fester RAM-Verbrauch neuer E-Mails\nHinzufügen von Zähleraufsätzen in JSON",
|
|
9
|
+
"ru": "Фиксированное потребление RAM новых писем\nДобавлены вложения счетчиков в JSON",
|
|
10
|
+
"pt": "Consumo de RAM fixo de novos e-mails\nAdicionado contra anexos em JSON",
|
|
11
|
+
"nl": "Vertaling:\nVertaling:",
|
|
12
|
+
"fr": "Consommation de RAM fixe de nouveaux emails\nAjout de pièces jointes dans JSON",
|
|
13
|
+
"it": "Risolto consumo di RAM di nuove email\nAggiunto accessori contatore in JSON",
|
|
14
|
+
"es": "Consumo de RAM fijo de nuevos correos electrónicos\nAgregados contadores en JSON",
|
|
15
|
+
"pl": "Zużycie pamięci RAM nowej e-maili\nAdded counter przywiązania w JSON",
|
|
16
|
+
"uk": "Виправлено споживання оперативної пам'яті нових електронних листів\nДодано лічильник вкладення в JSON",
|
|
17
|
+
"zh-cn": "新电子邮件的分期消费\n增加联索行动内的反附属"
|
|
18
|
+
},
|
|
19
|
+
"0.0.8": {
|
|
20
|
+
"en": "Fix refresh crash\nAdded MB threshold",
|
|
21
|
+
"de": "Erfrischungsabsturz beheben\nMB Schwelle",
|
|
22
|
+
"ru": "Исправить освежающие аварии\nДобавлен MB порог",
|
|
23
|
+
"pt": "Corrigir acidente de atualização\nLimite de MB adicionado",
|
|
24
|
+
"nl": "Verfrissende crash\nVertaling:",
|
|
25
|
+
"fr": "Réparer un crash\nAjout du seuil de MB",
|
|
26
|
+
"it": "Fissare l'incidente di aggiornamento\nSoglia MB aggiuntiva",
|
|
27
|
+
"es": "Cierre de refresco\nUmbral de MB",
|
|
28
|
+
"pl": "Fixel crash\nAdded MB progym",
|
|
29
|
+
"uk": "Виправлення аварійних змін\nДодано поріг MB",
|
|
30
|
+
"zh-cn": "Fixtifresh c\nA. 增加MB门槛"
|
|
31
|
+
},
|
|
6
32
|
"0.0.7": {
|
|
7
33
|
"en": "Fix correct counter for seen and unseen\nAdded capabilities\nCriteria change without restart\nAdded outlook.office365.com oauth2 login\nAdded Connection.js from Module to Adapter\nBug fixes",
|
|
8
34
|
"de": "Fix korrekter Zähler für gesehen und unsichtbar\nZusätzliche Fähigkeiten\nÄnderung der Kriterien ohne Neustart\nAusblick.office365.com oauth2 login\nHinzugefügt Connection.js von Modul zu Adapter\nFehlerbehebungen",
|
|
@@ -67,19 +93,6 @@
|
|
|
67
93
|
"pl": "Beta",
|
|
68
94
|
"uk": "Бета реліз",
|
|
69
95
|
"zh-cn": "B. 释放"
|
|
70
|
-
},
|
|
71
|
-
"0.0.2": {
|
|
72
|
-
"en": "initial release",
|
|
73
|
-
"de": "erstausstrahlung",
|
|
74
|
-
"ru": "начальный выпуск",
|
|
75
|
-
"pt": "lançamento inicial",
|
|
76
|
-
"nl": "niet",
|
|
77
|
-
"fr": "initial release",
|
|
78
|
-
"it": "rilascio iniziale",
|
|
79
|
-
"es": "liberación inicial",
|
|
80
|
-
"pl": "pierwsze wydanie",
|
|
81
|
-
"uk": "початковий реліз",
|
|
82
|
-
"zh-cn": "初步释放"
|
|
83
96
|
}
|
|
84
97
|
},
|
|
85
98
|
"titleLang": {
|
|
@@ -154,7 +167,13 @@
|
|
|
154
167
|
"native": {
|
|
155
168
|
"hosts": [],
|
|
156
169
|
"icons": [],
|
|
157
|
-
"oauth_token": []
|
|
170
|
+
"oauth_token": [],
|
|
171
|
+
"max_mb": 400,
|
|
172
|
+
"max_mb_selection": 2,
|
|
173
|
+
"max_mb_telegram": "",
|
|
174
|
+
"max_mb_telegram_user": "",
|
|
175
|
+
"max_mb_object": "",
|
|
176
|
+
"max_mb_last_restart": 0
|
|
158
177
|
},
|
|
159
178
|
"encryptedNative": [
|
|
160
179
|
"password",
|
package/lib/Connection.js
CHANGED
|
@@ -1089,9 +1089,11 @@ class Connection extends EventEmitter {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
this._curReq.cbargs.push(box);
|
|
1091
1091
|
} else if (type === "fetch") {
|
|
1092
|
-
|
|
1092
|
+
if (this._curReq && this._curReq.fullcmd) {
|
|
1093
|
+
this.debug("this._curReq.fullcmd: " + this._curReq.fullcmd);
|
|
1094
|
+
}
|
|
1093
1095
|
this.debug("infos: " + JSON.stringify(info));
|
|
1094
|
-
if (/^(?:UID )?FETCH/.test(this._curReq.fullcmd)) {
|
|
1096
|
+
if (this._curReq && this._curReq.fullcmd != null && /^(?:UID )?FETCH/.test(this._curReq.fullcmd)) {
|
|
1095
1097
|
this.debug("this._curReq.fullcmd: " + this._curReq.fullcmd);
|
|
1096
1098
|
this.debug("this._curReq.fetchCache[info.num]: " + this._curReq.fetchCache[info.num]);
|
|
1097
1099
|
// FETCH response sent as result of FETCH request
|
package/lib/imap_event.js
CHANGED
|
@@ -128,6 +128,7 @@ module.exports = {
|
|
|
128
128
|
mail.attachments = 0;
|
|
129
129
|
}
|
|
130
130
|
this.setMail(mail, seqno, attrs, info, client, counter, all, sort);
|
|
131
|
+
stream.resume();
|
|
131
132
|
resolve(true);
|
|
132
133
|
});
|
|
133
134
|
});
|
|
@@ -377,17 +378,21 @@ module.exports = {
|
|
|
377
378
|
this.setUpdate(client, { flags: [], new_mail: count }, "new mail");
|
|
378
379
|
const inbox = this.clientsRaw[client].inbox_activ;
|
|
379
380
|
const new_mail = await this.loadAllSeqno(client, inbox, true);
|
|
380
|
-
let nextuid = this.diffArray(this.clientsRaw[client][inbox], new_mail, 2);
|
|
381
|
+
let nextuid = this.diffArray(this.clientsRaw[client][inbox], new_mail, 2, client);
|
|
382
|
+
this.clientsRaw[client][inbox] = new_mail;
|
|
381
383
|
if (nextuid.length === 0) {
|
|
382
384
|
nextuid = [box.uidnext];
|
|
383
385
|
}
|
|
384
386
|
if (this.clients[client].serverSupports("SORT")) {
|
|
387
|
+
//this.log.info("newMailsSort");
|
|
385
388
|
this.newMailsSort(client, nextuid, "new");
|
|
386
389
|
} else {
|
|
387
390
|
if (nextuid.length > 0) {
|
|
388
391
|
this.newMails(client, nextuid, "new");
|
|
392
|
+
//this.log.info("newMails");
|
|
389
393
|
} else {
|
|
390
394
|
this.readMails(client);
|
|
395
|
+
//this.log.info("readMails");
|
|
391
396
|
}
|
|
392
397
|
}
|
|
393
398
|
this.setTotal(client, this.clientsRaw[client].inbox_activ);
|
|
@@ -403,7 +408,7 @@ module.exports = {
|
|
|
403
408
|
} catch (e) {
|
|
404
409
|
this.flag = ["ALL"];
|
|
405
410
|
}
|
|
406
|
-
if (this.
|
|
411
|
+
if (this.clients[client].serverSupports("SORT")) {
|
|
407
412
|
this.readMailsSort(client);
|
|
408
413
|
} else {
|
|
409
414
|
this.readMails(client);
|
|
@@ -437,6 +442,7 @@ module.exports = {
|
|
|
437
442
|
mail.attachments = 0;
|
|
438
443
|
}
|
|
439
444
|
this.updatejson(mail, seqno, attrs, info, client, what);
|
|
445
|
+
stream.resume();
|
|
440
446
|
});
|
|
441
447
|
});
|
|
442
448
|
f.once("error", (error) => {
|
|
@@ -474,6 +480,7 @@ module.exports = {
|
|
|
474
480
|
mail.attachments = 0;
|
|
475
481
|
}
|
|
476
482
|
this.updatejson(mail, seqno, attrs, info, client, what);
|
|
483
|
+
stream.resume();
|
|
477
484
|
});
|
|
478
485
|
});
|
|
479
486
|
f.once("error", (error) => {
|
|
@@ -487,18 +494,29 @@ module.exports = {
|
|
|
487
494
|
* @param {object} arr1
|
|
488
495
|
* @param {object} arr2
|
|
489
496
|
* @param {number} [from=0]
|
|
497
|
+
* @param {string} [client=""]
|
|
490
498
|
*/
|
|
491
|
-
diffArray(arr1, arr2, from) {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
499
|
+
diffArray(arr1, arr2, from, client) {
|
|
500
|
+
try {
|
|
501
|
+
const diff = (a, b) => a.filter((item) => b.indexOf(item) === -1);
|
|
502
|
+
if (from === 1) {
|
|
503
|
+
return diff(arr1, arr2);
|
|
504
|
+
}
|
|
505
|
+
if (from === 2) {
|
|
506
|
+
return diff(arr2, arr1);
|
|
507
|
+
}
|
|
508
|
+
const diff1 = diff(arr1, arr2);
|
|
509
|
+
const diff2 = diff(arr2, arr1);
|
|
510
|
+
return [].concat(diff1, diff2);
|
|
511
|
+
} catch (e) {
|
|
512
|
+
this.log_translator(
|
|
513
|
+
"warn",
|
|
514
|
+
"Error",
|
|
515
|
+
client,
|
|
516
|
+
`${JSON.stringify(arr1)} - ${JSON.stringify(arr2)} - ${JSON.stringify(from)}`,
|
|
517
|
+
);
|
|
518
|
+
return 0;
|
|
498
519
|
}
|
|
499
|
-
const diff1 = diff(arr1, arr2);
|
|
500
|
-
const diff2 = diff(arr2, arr1);
|
|
501
|
-
return [].concat(diff1, diff2);
|
|
502
520
|
},
|
|
503
521
|
/**
|
|
504
522
|
* @param {string} client device id
|
|
@@ -557,6 +575,7 @@ module.exports = {
|
|
|
557
575
|
mail.attachments = 0;
|
|
558
576
|
}
|
|
559
577
|
this.updatejson(mail, seqno, attrs, info, client, what);
|
|
578
|
+
stream.resume();
|
|
560
579
|
});
|
|
561
580
|
});
|
|
562
581
|
f.once("error", (error) => {
|
|
@@ -576,7 +595,7 @@ module.exports = {
|
|
|
576
595
|
* @param {string|object} box
|
|
577
596
|
*/
|
|
578
597
|
change_events(client, event, uid, box) {
|
|
579
|
-
this.
|
|
598
|
+
this.clients[client][event](uid, box, (err) => {
|
|
580
599
|
if (!err) {
|
|
581
600
|
this.log_translator("info", "SetFlag", `${JSON.stringify(uid)}: ${event} success`, client);
|
|
582
601
|
} else {
|
|
@@ -730,7 +749,6 @@ module.exports = {
|
|
|
730
749
|
*/
|
|
731
750
|
readAllMails(client, result, obj, count) {
|
|
732
751
|
const all_mails = [];
|
|
733
|
-
const mails = {};
|
|
734
752
|
let counter = 0;
|
|
735
753
|
return new Promise((resolve) => {
|
|
736
754
|
try {
|
|
@@ -744,6 +762,7 @@ module.exports = {
|
|
|
744
762
|
attrs = att;
|
|
745
763
|
});
|
|
746
764
|
msg.on("body", async (stream, info) => {
|
|
765
|
+
const mails = {};
|
|
747
766
|
if (obj.message.parse) {
|
|
748
767
|
mails["body"] = await simpleParser(stream);
|
|
749
768
|
} else {
|
|
@@ -755,6 +774,7 @@ module.exports = {
|
|
|
755
774
|
mails["user"] = client;
|
|
756
775
|
++counter;
|
|
757
776
|
all_mails.push(mails);
|
|
777
|
+
stream.resume();
|
|
758
778
|
if (count == counter) {
|
|
759
779
|
resolve(all_mails);
|
|
760
780
|
}
|
package/lib/translator.js
CHANGED
|
@@ -64,6 +64,19 @@ exports.trans = {
|
|
|
64
64
|
uk: "try %s",
|
|
65
65
|
"zh-cn": "try %s",
|
|
66
66
|
},
|
|
67
|
+
"Change common": {
|
|
68
|
+
en: "Change common %s",
|
|
69
|
+
de: "Change common %s",
|
|
70
|
+
ru: "Change common %s",
|
|
71
|
+
pt: "Change common %s",
|
|
72
|
+
nl: "Change common %s",
|
|
73
|
+
fr: "Change common %s",
|
|
74
|
+
it: "Change common %s",
|
|
75
|
+
es: "Change common %s",
|
|
76
|
+
pl: "Change common %s",
|
|
77
|
+
uk: "Change common %s",
|
|
78
|
+
"zh-cn": "Change common %s",
|
|
79
|
+
},
|
|
67
80
|
Datapoint: {
|
|
68
81
|
en: "Datapoint: %s",
|
|
69
82
|
de: "Datapoint: %s",
|
|
@@ -233,19 +246,6 @@ exports.trans = {
|
|
|
233
246
|
uk: "Атрибут %s змінено для пристрою %s.",
|
|
234
247
|
"zh-cn": "对装置%s的降解量%s。.",
|
|
235
248
|
},
|
|
236
|
-
"Change common": {
|
|
237
|
-
en: "Change common %s",
|
|
238
|
-
de: "Change common %s",
|
|
239
|
-
ru: "Change common %s",
|
|
240
|
-
pt: "Change common %s",
|
|
241
|
-
nl: "Change common %s",
|
|
242
|
-
fr: "Change common %s",
|
|
243
|
-
it: "Change common %s",
|
|
244
|
-
es: "Change common %s",
|
|
245
|
-
pl: "Change common %s",
|
|
246
|
-
uk: "Change common %s",
|
|
247
|
-
"zh-cn": "Change common %s",
|
|
248
|
-
},
|
|
249
249
|
"missing port": {
|
|
250
250
|
en: "No port entered in the instance. The standard port 993 is used.",
|
|
251
251
|
de: "Kein Port in der Instanz eingegeben. Der Standardport 993 wird verwendet.",
|
|
@@ -2469,4 +2469,82 @@ exports.trans = {
|
|
|
2469
2469
|
uk: "Неможливо розшифрувати пароль! Будь ласка, перезапустіть адаптер! - %s",
|
|
2470
2470
|
"zh-cn": "不能把言词加一! 请再接再厉! - %s",
|
|
2471
2471
|
},
|
|
2472
|
+
"Restart Adapter": {
|
|
2473
|
+
en: "Memory MEMRSS %s above threshold %s Adapter is restarting.",
|
|
2474
|
+
de: "Speicher MEMRSS %s oberhalb der Schwelle %s Adapter wird neu gestartet.",
|
|
2475
|
+
ru: "Память MEMRSS %s над порогом %s Адаптер перезапускается.",
|
|
2476
|
+
pt: "Memória MEMRSS %s limiar acima %s O adaptador está a reiniciar.",
|
|
2477
|
+
nl: "Memory MeMRS %s drempel %s Adapter herstelt.",
|
|
2478
|
+
fr: "Memory MEMRSS %s au-dessus du seuil %s L'adaptateur redémarre.",
|
|
2479
|
+
it: "Memoria MEMRSS %s sopra la soglia %s L'adattatore sta riavviando.",
|
|
2480
|
+
es: "Memoria MEMRSS %s above threshold %s El adaptador está descansando.",
|
|
2481
|
+
pl: "Pamięć pamięci %s powyżej progu %s Adapter jest odwrócony.",
|
|
2482
|
+
uk: "Пам'яті MEMRSS %s над порігм %s Адаптер перезавантаження.",
|
|
2483
|
+
"zh-cn": "中小企业福利 %s 以上阈值 %s 道歉正在恢复。.",
|
|
2484
|
+
},
|
|
2485
|
+
"Restart Adapter Text": {
|
|
2486
|
+
en: "Threshold reached with %s MB.",
|
|
2487
|
+
de: "Schwellwert erreicht mit %s MB.",
|
|
2488
|
+
ru: "Threshold достиг %s МБ.",
|
|
2489
|
+
pt: "Threshold chegou com %s MB.",
|
|
2490
|
+
nl: "Drempel bereikt met %s MB.",
|
|
2491
|
+
fr: "Le seuil atteint %s Mo.",
|
|
2492
|
+
it: "Soglia raggiunta con %s MB.",
|
|
2493
|
+
es: "Umbral alcanzado con %s MB.",
|
|
2494
|
+
pl: "Threshold osiągnął wynik %s MB.",
|
|
2495
|
+
uk: "Досягнення з %s Мб.",
|
|
2496
|
+
"zh-cn": "至 %s 议 程.",
|
|
2497
|
+
},
|
|
2498
|
+
"Restart Adapter Header": {
|
|
2499
|
+
en: "Threshold",
|
|
2500
|
+
de: "Schwellwert",
|
|
2501
|
+
ru: "Порог",
|
|
2502
|
+
pt: "Limitação",
|
|
2503
|
+
nl: "Draad",
|
|
2504
|
+
fr: "Threshold",
|
|
2505
|
+
it: "Soglia",
|
|
2506
|
+
es: "Umbral",
|
|
2507
|
+
pl: "Threshold",
|
|
2508
|
+
uk: "Пороги",
|
|
2509
|
+
"zh-cn": "解雇",
|
|
2510
|
+
},
|
|
2511
|
+
"No threshold": {
|
|
2512
|
+
en: "Threshold with %s MB not reached.",
|
|
2513
|
+
de: "Schwellwert mit %s MB nicht erreicht.",
|
|
2514
|
+
ru: "Порог с %s МБ не достигнут.",
|
|
2515
|
+
pt: "Limite com %s MB não alcançado.",
|
|
2516
|
+
nl: "Dreigen met %s MB niet bereikt.",
|
|
2517
|
+
fr: "Le seuil de %s Mo n'est pas atteint.",
|
|
2518
|
+
it: "Soglia con %s MB non raggiunta.",
|
|
2519
|
+
es: "Umbral con %s MB no alcanzado.",
|
|
2520
|
+
pl: "Dotarł do niego %s MB.",
|
|
2521
|
+
uk: "Пороги з %s Мб не досягли.",
|
|
2522
|
+
"zh-cn": "暂不达 %s 个。.",
|
|
2523
|
+
},
|
|
2524
|
+
"Restart Adapter Text NO DP": {
|
|
2525
|
+
en: "No data point specified.",
|
|
2526
|
+
de: "Kein Datenpunkt angegeben.",
|
|
2527
|
+
ru: "Нет данных.",
|
|
2528
|
+
pt: "Nenhum ponto de dados especificado.",
|
|
2529
|
+
nl: "Geen gegevens gespecificeerd.",
|
|
2530
|
+
fr: "Aucun point de données spécifié.",
|
|
2531
|
+
it: "Nessun punto di dati specificato.",
|
|
2532
|
+
es: "No se especifica ningún punto de datos.",
|
|
2533
|
+
pl: "Nie ma określonego punktu danych.",
|
|
2534
|
+
uk: "Немає вказаної точки даних.",
|
|
2535
|
+
"zh-cn": "没有具体说明数据点。.",
|
|
2536
|
+
},
|
|
2537
|
+
"Adapter could not restart": {
|
|
2538
|
+
en: "Adapter could not restart - %s",
|
|
2539
|
+
de: "Adapter konnte nicht neu starten - %s",
|
|
2540
|
+
ru: "Адаптер не может перезапустить - %s",
|
|
2541
|
+
pt: "Adaptador não poderia reiniciar - %s",
|
|
2542
|
+
nl: "Adapter kon niet herstarten - %s",
|
|
2543
|
+
fr: "Adaptateur ne peut pas redémarrer - %s",
|
|
2544
|
+
it: "Adattatore non poteva riavviare - %s",
|
|
2545
|
+
es: "Adaptador no puede reiniciar - %s",
|
|
2546
|
+
pl: "Adapter nie mógł restartować - %s",
|
|
2547
|
+
uk: "Адаптер не може перезапустити - %s",
|
|
2548
|
+
"zh-cn": "道歉不能再恢复。 - %s",
|
|
2549
|
+
},
|
|
2472
2550
|
};
|
package/main.js
CHANGED
|
@@ -73,6 +73,8 @@ class Imap extends utils.Adapter {
|
|
|
73
73
|
this.custom_search = imap_event.custom_search;
|
|
74
74
|
this.loadUnseenSeqno = imap_event.loadUnseenSeqno;
|
|
75
75
|
this.changesearch = imap_event.changesearch;
|
|
76
|
+
this.startReadMails = imap_event.startReadMails;
|
|
77
|
+
this.readAllMails = imap_event.readAllMails;
|
|
76
78
|
this.qualityInterval = null;
|
|
77
79
|
this.statusInterval = null;
|
|
78
80
|
this.sleepTimer = null;
|
|
@@ -106,6 +108,8 @@ class Imap extends utils.Adapter {
|
|
|
106
108
|
// Initialize your adapter here
|
|
107
109
|
const devices = {};
|
|
108
110
|
const selectbox = {};
|
|
111
|
+
this.config.max_mb = this.config.max_mb > 600 ? 600 : this.config.max_mb;
|
|
112
|
+
this.config.max_mb = this.config.max_mb < 100 ? 100 : this.config.max_mb;
|
|
109
113
|
if (Object.keys(this.config.hosts).length === 0) {
|
|
110
114
|
this.log_translator("info", "No imap");
|
|
111
115
|
return;
|
|
@@ -162,6 +166,10 @@ class Imap extends utils.Adapter {
|
|
|
162
166
|
this.log_translator("info", "missing password");
|
|
163
167
|
continue;
|
|
164
168
|
}
|
|
169
|
+
dev.maxi_html = dev.maxi_html > 99 ? 99 : dev.maxi_html;
|
|
170
|
+
dev.maxi_html = dev.maxi_html < 1 ? 1 : dev.maxi_html;
|
|
171
|
+
dev.maxi = dev.maxi > 99 ? 99 : dev.maxi;
|
|
172
|
+
dev.maxi = dev.maxi < 1 ? 1 : dev.maxi;
|
|
165
173
|
dev["max"] = dev.maxi_html > dev.maxi ? dev.maxi_html : dev.maxi;
|
|
166
174
|
dev["inbox_activ"] = dev.inbox;
|
|
167
175
|
this.clientsIDdelete.push(dev);
|
|
@@ -199,6 +207,7 @@ class Imap extends utils.Adapter {
|
|
|
199
207
|
await this.checkDeviceFolder();
|
|
200
208
|
this.qualityInterval = this.setInterval(() => {
|
|
201
209
|
this.cleanupQuality();
|
|
210
|
+
this.memrsscheck();
|
|
202
211
|
}, 60 * 60 * 24 * 1000);
|
|
203
212
|
this.statusInterval = this.setInterval(() => {
|
|
204
213
|
this.connectionCheck();
|
|
@@ -207,6 +216,7 @@ class Imap extends utils.Adapter {
|
|
|
207
216
|
this.checksupport();
|
|
208
217
|
await this.createSelect(selectbox);
|
|
209
218
|
this.subscribeStates(`json_imap`);
|
|
219
|
+
this.subscribeForeignStates(`system.adapter.${this.namespace}.memRss`);
|
|
210
220
|
}
|
|
211
221
|
|
|
212
222
|
/**
|
|
@@ -283,7 +293,7 @@ class Imap extends utils.Adapter {
|
|
|
283
293
|
const last = element.id.split(".").pop();
|
|
284
294
|
const html = await this.getStateAsync(`${dev.user}.remote.html.${last}`);
|
|
285
295
|
if (html != undefined && last != undefined && this.clientsHTML[dev.user] != null) {
|
|
286
|
-
this.clientsHTML[dev.user][last] = html
|
|
296
|
+
this.clientsHTML[dev.user][last] = html.val;
|
|
287
297
|
}
|
|
288
298
|
}
|
|
289
299
|
}
|
|
@@ -578,6 +588,8 @@ class Imap extends utils.Adapter {
|
|
|
578
588
|
this.save_json[clientID][merge] = mail;
|
|
579
589
|
}
|
|
580
590
|
}
|
|
591
|
+
//this.log.info("COUNT SINGLE: " + Object.keys(this.save_json[clientID]).length);
|
|
592
|
+
//this.log.info("COUNT ALL: " + Object.keys(this.save_json).length);
|
|
581
593
|
this.updateIMAPData(clientID, false, false);
|
|
582
594
|
}
|
|
583
595
|
|
|
@@ -777,24 +789,25 @@ class Imap extends utils.Adapter {
|
|
|
777
789
|
*/
|
|
778
790
|
async setStatesValue(mail, seqno, clientID, count, attrs, info) {
|
|
779
791
|
try {
|
|
780
|
-
|
|
792
|
+
const id = `${clientID}.email.email_${("0" + count).slice(-2)}`;
|
|
793
|
+
await this.setStateAsync(`${id}.subject`, {
|
|
781
794
|
val: mail.subject != null ? mail.subject : this.helper_translator("Unknown"),
|
|
782
795
|
ack: true,
|
|
783
796
|
});
|
|
784
797
|
//const receive_date = mail.date.toISOString().replace("T", " ").replace(/\..+/, "");
|
|
785
|
-
await this.setStateAsync(`${
|
|
798
|
+
await this.setStateAsync(`${id}.receive`, {
|
|
786
799
|
val: mail.date != null ? mail.date.toString() : this.helper_translator("Unknown"),
|
|
787
800
|
ack: true,
|
|
788
801
|
});
|
|
789
|
-
await this.setStateAsync(`${
|
|
802
|
+
await this.setStateAsync(`${id}.content`, {
|
|
790
803
|
val: mail.html != null && mail.html ? mail.html : this.helper_translator("Unknown"),
|
|
791
804
|
ack: true,
|
|
792
805
|
});
|
|
793
|
-
await this.setStateAsync(`${
|
|
806
|
+
await this.setStateAsync(`${id}.text`, {
|
|
794
807
|
val: mail.text != null ? mail.text : this.helper_translator("Unknown"),
|
|
795
808
|
ack: true,
|
|
796
809
|
});
|
|
797
|
-
await this.setStateAsync(`${
|
|
810
|
+
await this.setStateAsync(`${id}.texthtml`, {
|
|
798
811
|
val: mail.textAsHtml != null ? mail.textAsHtml : this.helper_translator("Unknown"),
|
|
799
812
|
ack: true,
|
|
800
813
|
});
|
|
@@ -806,7 +819,7 @@ class Imap extends utils.Adapter {
|
|
|
806
819
|
}
|
|
807
820
|
}
|
|
808
821
|
}
|
|
809
|
-
await this.setStateAsync(`${
|
|
822
|
+
await this.setStateAsync(`${id}.to`, {
|
|
810
823
|
val: JSON.stringify(add),
|
|
811
824
|
ack: true,
|
|
812
825
|
});
|
|
@@ -818,32 +831,30 @@ class Imap extends utils.Adapter {
|
|
|
818
831
|
}
|
|
819
832
|
}
|
|
820
833
|
}
|
|
821
|
-
await this.setStateAsync(`${
|
|
834
|
+
await this.setStateAsync(`${id}.from`, {
|
|
822
835
|
val: JSON.stringify(add),
|
|
823
836
|
ack: true,
|
|
824
837
|
});
|
|
825
|
-
await this.setStateAsync(`${
|
|
826
|
-
val: attrs.flags != null ? JSON.stringify(attrs.flags) : "",
|
|
838
|
+
await this.setStateAsync(`${id}.flag`, {
|
|
839
|
+
val: attrs.flags != null ? JSON.stringify(attrs.flags) : this.helper_translator("Unknown"),
|
|
827
840
|
ack: true,
|
|
828
841
|
});
|
|
829
|
-
await this.setStateAsync(`${
|
|
842
|
+
await this.setStateAsync(`${id}.uid`, {
|
|
830
843
|
val: attrs.uid != null ? attrs.uid : 0,
|
|
831
844
|
ack: true,
|
|
832
845
|
});
|
|
833
|
-
await this.setStateAsync(`${
|
|
846
|
+
await this.setStateAsync(`${id}.seq`, {
|
|
834
847
|
val: seqno != null ? seqno : 0,
|
|
835
848
|
ack: true,
|
|
836
849
|
});
|
|
837
|
-
await this.setStateAsync(`${
|
|
850
|
+
await this.setStateAsync(`${id}.size`, {
|
|
838
851
|
val: info.size != null ? info.size : 0,
|
|
839
852
|
ack: true,
|
|
840
853
|
});
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
});
|
|
846
|
-
}
|
|
854
|
+
await this.setStateAsync(`${id}.attach`, {
|
|
855
|
+
val: mail.attachments != null ? mail.attachments : 0,
|
|
856
|
+
ack: true,
|
|
857
|
+
});
|
|
847
858
|
} catch (e) {
|
|
848
859
|
this.log_translator("error", "try", `setStatesValue: ${e}`);
|
|
849
860
|
}
|
|
@@ -1083,6 +1094,18 @@ class Imap extends utils.Adapter {
|
|
|
1083
1094
|
* @param {ioBroker.State | null | undefined} state
|
|
1084
1095
|
*/
|
|
1085
1096
|
async onStateChange(id, state) {
|
|
1097
|
+
if (state && state.ack) {
|
|
1098
|
+
const command = id.split(".").pop();
|
|
1099
|
+
if (command === "memRss") {
|
|
1100
|
+
if (
|
|
1101
|
+
typeof state.val === "number" &&
|
|
1102
|
+
state.val > this.config.max_mb &&
|
|
1103
|
+
this.config.max_mb_selection === 1
|
|
1104
|
+
) {
|
|
1105
|
+
this.memrsscheck();
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1086
1109
|
if (state && !state.ack) {
|
|
1087
1110
|
const command = id.split(".").pop();
|
|
1088
1111
|
const clientID = id.split(".")[2];
|
|
@@ -1131,7 +1154,7 @@ class Imap extends utils.Adapter {
|
|
|
1131
1154
|
}
|
|
1132
1155
|
if (command === "vis_command") {
|
|
1133
1156
|
if (state.val != "") {
|
|
1134
|
-
const value = state.val
|
|
1157
|
+
const value = state.val != null ? state.val.toString().split("<L>") : [];
|
|
1135
1158
|
if (value != null && value[0] != null && value[1] != null && value[2] != null) {
|
|
1136
1159
|
if (value[0] === "copy" || value[0] === "move") {
|
|
1137
1160
|
this.applyCopyMove(value[0], clientID, Number(value[1]), value[2]);
|
|
@@ -1174,7 +1197,11 @@ class Imap extends utils.Adapter {
|
|
|
1174
1197
|
if (this.save_json[clientID] && Object.keys(this.save_json[clientID]).length > 0) {
|
|
1175
1198
|
this.updateIMAPData(clientID, false, true);
|
|
1176
1199
|
} else {
|
|
1177
|
-
this.clients[clientID].
|
|
1200
|
+
if (this.clients[clientID].serverSupports("SORT")) {
|
|
1201
|
+
this.readMailsSort(clientID);
|
|
1202
|
+
} else {
|
|
1203
|
+
this.readMails(clientID);
|
|
1204
|
+
}
|
|
1178
1205
|
}
|
|
1179
1206
|
this.setAckFlag(id, { val: false });
|
|
1180
1207
|
}
|
|
@@ -1182,7 +1209,11 @@ class Imap extends utils.Adapter {
|
|
|
1182
1209
|
}
|
|
1183
1210
|
if (command === "reload_emails" && state.val) {
|
|
1184
1211
|
if (this.clients[clientID]) {
|
|
1185
|
-
this.clients[clientID].
|
|
1212
|
+
if (this.clients[clientID].serverSupports("SORT")) {
|
|
1213
|
+
this.readMailsSort(clientID);
|
|
1214
|
+
} else {
|
|
1215
|
+
this.readMails(clientID);
|
|
1216
|
+
}
|
|
1186
1217
|
this.setAckFlag(id, { val: false });
|
|
1187
1218
|
}
|
|
1188
1219
|
return;
|
|
@@ -1263,7 +1294,7 @@ class Imap extends utils.Adapter {
|
|
|
1263
1294
|
const folders = await this.getStateAsync(`${clientID}.remote.${command}.folder`);
|
|
1264
1295
|
folder = folders && folders.val ? folders.val.toString() : "";
|
|
1265
1296
|
}
|
|
1266
|
-
if (uid === 0) {
|
|
1297
|
+
if (uid === 0 || uid == null) {
|
|
1267
1298
|
const uids = await this.getStateAsync(`${clientID}.remote.${command}.uid`);
|
|
1268
1299
|
uid = uids && uids.val != null ? Number(uids.val) : 0;
|
|
1269
1300
|
}
|
|
@@ -1661,6 +1692,7 @@ class Imap extends utils.Adapter {
|
|
|
1661
1692
|
}
|
|
1662
1693
|
}
|
|
1663
1694
|
}
|
|
1695
|
+
new_json["attach"] = element.attachments != null ? element.attachments : 0;
|
|
1664
1696
|
new_json["to"] = addaddress;
|
|
1665
1697
|
new_json["to_name"] = addname;
|
|
1666
1698
|
new_json["subject"] = element.subject ? element.subject : "";
|
|
@@ -1774,6 +1806,68 @@ class Imap extends utils.Adapter {
|
|
|
1774
1806
|
this.log_translator("error", "try", `cleanupQuality: ${e}`);
|
|
1775
1807
|
}
|
|
1776
1808
|
}
|
|
1809
|
+
|
|
1810
|
+
async memrsscheck() {
|
|
1811
|
+
const memrss = await this.getForeignStateAsync(`system.adapter.${this.namespace}.memRss`);
|
|
1812
|
+
const memrss_value = memrss != null && typeof memrss.val === "number" ? memrss.val : 0;
|
|
1813
|
+
if (memrss_value > this.config.max_mb) {
|
|
1814
|
+
if (this.config.max_mb_selection === 1) {
|
|
1815
|
+
const instances = this.config.max_mb_telegram.replace(/ /g, "").split(",");
|
|
1816
|
+
const instancesUser = this.config.max_mb_telegram_user.replace(/ /g, "").split(",");
|
|
1817
|
+
for (const instance of instances) {
|
|
1818
|
+
const text = this.helper_translator("Restart Adapter Text", memrss_value);
|
|
1819
|
+
const title = this.helper_translator("Restart Adapter Header");
|
|
1820
|
+
if (instancesUser.length > 0) {
|
|
1821
|
+
for (const user of instancesUser) {
|
|
1822
|
+
if (instance.includes("pushover")) {
|
|
1823
|
+
await this.sendToAsync(instance, {
|
|
1824
|
+
device: user,
|
|
1825
|
+
message: text,
|
|
1826
|
+
title: title,
|
|
1827
|
+
});
|
|
1828
|
+
} else if (instance.includes("signal-cmb")) {
|
|
1829
|
+
await this.sendToAsync(instance, "send", {
|
|
1830
|
+
text: text,
|
|
1831
|
+
phone: user,
|
|
1832
|
+
});
|
|
1833
|
+
} else {
|
|
1834
|
+
await this.sendToAsync(instance, { user: user, text: text });
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
} else {
|
|
1838
|
+
if (instance.includes("pushover")) {
|
|
1839
|
+
await this.sendToAsync(instance, { message: text, title: title });
|
|
1840
|
+
} else if (instance.includes("signal-cmb")) {
|
|
1841
|
+
await this.sendToAsync(instance, "send", {
|
|
1842
|
+
text: text,
|
|
1843
|
+
});
|
|
1844
|
+
} else {
|
|
1845
|
+
await this.sendToAsync(instance, text);
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
} else if (this.config.max_mb_selection === 2) {
|
|
1850
|
+
this.log_translator("info", "Restart Adapter", memrss_value, this.config.max_mb);
|
|
1851
|
+
//this.restart();
|
|
1852
|
+
try {
|
|
1853
|
+
await this.extendForeignObjectAsync(`system.adapter.${this.namespace}`, {
|
|
1854
|
+
native: { max_mb_last_restart: Date.now() },
|
|
1855
|
+
});
|
|
1856
|
+
} catch (e) {
|
|
1857
|
+
this.log_translator("info", "Adapter could not restart", e.message);
|
|
1858
|
+
}
|
|
1859
|
+
} else if (this.config.max_mb_selection === 3) {
|
|
1860
|
+
if (this.config.max_mb_object != "") {
|
|
1861
|
+
await this.setStateAsync(this.config.max_mb_object, true, false);
|
|
1862
|
+
this.log_translator("info", "Restart Adapter Text", memrss_value);
|
|
1863
|
+
} else {
|
|
1864
|
+
this.log_translator("info", "Restart Adapter Text NO DP", memrss_value);
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
} else {
|
|
1868
|
+
this.log_translator("info", "No threshold", memrss_value);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1777
1871
|
}
|
|
1778
1872
|
|
|
1779
1873
|
if (require.main !== module) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.imap",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "imap to receive your emails",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Lucky-ESA",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"node": ">= 16"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@azure/msal-node": "^1.
|
|
25
|
+
"@azure/msal-node": "^1.18.0",
|
|
26
26
|
"@iobroker/adapter-core": "^2.6.8",
|
|
27
27
|
"mailparser": "^3.6.3",
|
|
28
28
|
"node-imap": "^0.9.6"
|
|
@@ -34,26 +34,26 @@
|
|
|
34
34
|
"@alcalzone/release-script-plugin-manual-review": "^3.5.9",
|
|
35
35
|
"@iobroker/adapter-dev": "^1.2.0",
|
|
36
36
|
"@iobroker/testing": "^4.1.0",
|
|
37
|
-
"@tsconfig/node16": "^1.0
|
|
38
|
-
"@types/chai": "^4.3.
|
|
37
|
+
"@tsconfig/node16": "^16.1.0",
|
|
38
|
+
"@types/chai": "^4.3.5",
|
|
39
39
|
"@types/chai-as-promised": "^7.1.5",
|
|
40
|
-
"@types/imap": "^0.8.
|
|
40
|
+
"@types/imap": "^0.8.37",
|
|
41
41
|
"@types/mocha": "^10.0.1",
|
|
42
|
-
"@types/node": "^
|
|
42
|
+
"@types/node": "^20.2.5",
|
|
43
43
|
"@types/proxyquire": "^1.3.28",
|
|
44
44
|
"@types/sinon": "^10.0.13",
|
|
45
45
|
"@types/sinon-chai": "^3.2.9",
|
|
46
46
|
"chai": "^4.3.7",
|
|
47
47
|
"chai-as-promised": "^7.1.1",
|
|
48
|
-
"eslint": "^8.
|
|
48
|
+
"eslint": "^8.44.0",
|
|
49
49
|
"eslint-config-prettier": "^8.8.0",
|
|
50
50
|
"eslint-plugin-prettier": "^4.2.1",
|
|
51
51
|
"mocha": "^10.2.0",
|
|
52
|
-
"prettier": "^2.8.
|
|
52
|
+
"prettier": "^2.8.8",
|
|
53
53
|
"proxyquire": "^2.1.3",
|
|
54
|
-
"sinon": "^15.0
|
|
54
|
+
"sinon": "^15.2.0",
|
|
55
55
|
"sinon-chai": "^3.7.0",
|
|
56
|
-
"typescript": "~5.
|
|
56
|
+
"typescript": "~5.1.6"
|
|
57
57
|
},
|
|
58
58
|
"main": "main.js",
|
|
59
59
|
"files": [
|