iobroker.imap 0.0.7 → 0.0.8
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 +5 -0
- 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 +21 -2
- package/lib/Connection.js +4 -2
- package/lib/imap_event.js +30 -14
- package/lib/translator.js +91 -13
- package/main.js +114 -23
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -48,6 +48,11 @@
|
|
|
48
48
|
Placeholder for the next version (at the beginning of the line):
|
|
49
49
|
### **WORK IN PROGRESS**
|
|
50
50
|
-->
|
|
51
|
+
### 0.0.8 (2023-07-13)
|
|
52
|
+
|
|
53
|
+
- (Lucky-ESA) Fix refresh crash
|
|
54
|
+
- (Lucky-ESA) Added MB threshold
|
|
55
|
+
|
|
51
56
|
### 0.0.7 (2023-04-25)
|
|
52
57
|
|
|
53
58
|
- (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,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "imap",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.8",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.0.8": {
|
|
7
|
+
"en": "Fix refresh crash\nAdded MB threshold",
|
|
8
|
+
"de": "Erfrischungsabsturz beheben\nMB Schwelle",
|
|
9
|
+
"ru": "Исправить освежающие аварии\nДобавлен MB порог",
|
|
10
|
+
"pt": "Corrigir acidente de atualização\nLimite de MB adicionado",
|
|
11
|
+
"nl": "Verfrissende crash\nVertaling:",
|
|
12
|
+
"fr": "Réparer un crash\nAjout du seuil de MB",
|
|
13
|
+
"it": "Fissare l'incidente di aggiornamento\nSoglia MB aggiuntiva",
|
|
14
|
+
"es": "Cierre de refresco\nUmbral de MB",
|
|
15
|
+
"pl": "Fixel crash\nAdded MB progym",
|
|
16
|
+
"uk": "Виправлення аварійних змін\nДодано поріг MB",
|
|
17
|
+
"zh-cn": "Fixtifresh c\nA. 增加MB门槛"
|
|
18
|
+
},
|
|
6
19
|
"0.0.7": {
|
|
7
20
|
"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
21
|
"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",
|
|
@@ -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,7 +378,7 @@ 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);
|
|
381
382
|
if (nextuid.length === 0) {
|
|
382
383
|
nextuid = [box.uidnext];
|
|
383
384
|
}
|
|
@@ -403,7 +404,7 @@ module.exports = {
|
|
|
403
404
|
} catch (e) {
|
|
404
405
|
this.flag = ["ALL"];
|
|
405
406
|
}
|
|
406
|
-
if (this.
|
|
407
|
+
if (this.clients[client].serverSupports("SORT")) {
|
|
407
408
|
this.readMailsSort(client);
|
|
408
409
|
} else {
|
|
409
410
|
this.readMails(client);
|
|
@@ -437,6 +438,7 @@ module.exports = {
|
|
|
437
438
|
mail.attachments = 0;
|
|
438
439
|
}
|
|
439
440
|
this.updatejson(mail, seqno, attrs, info, client, what);
|
|
441
|
+
stream.resume();
|
|
440
442
|
});
|
|
441
443
|
});
|
|
442
444
|
f.once("error", (error) => {
|
|
@@ -474,6 +476,7 @@ module.exports = {
|
|
|
474
476
|
mail.attachments = 0;
|
|
475
477
|
}
|
|
476
478
|
this.updatejson(mail, seqno, attrs, info, client, what);
|
|
479
|
+
stream.resume();
|
|
477
480
|
});
|
|
478
481
|
});
|
|
479
482
|
f.once("error", (error) => {
|
|
@@ -487,18 +490,29 @@ module.exports = {
|
|
|
487
490
|
* @param {object} arr1
|
|
488
491
|
* @param {object} arr2
|
|
489
492
|
* @param {number} [from=0]
|
|
493
|
+
* @param {string} [client=""]
|
|
490
494
|
*/
|
|
491
|
-
diffArray(arr1, arr2, from) {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
495
|
+
diffArray(arr1, arr2, from, client) {
|
|
496
|
+
try {
|
|
497
|
+
const diff = (a, b) => a.filter((item) => b.indexOf(item) === -1);
|
|
498
|
+
if (from === 1) {
|
|
499
|
+
return diff(arr1, arr2);
|
|
500
|
+
}
|
|
501
|
+
if (from === 2) {
|
|
502
|
+
return diff(arr2, arr1);
|
|
503
|
+
}
|
|
504
|
+
const diff1 = diff(arr1, arr2);
|
|
505
|
+
const diff2 = diff(arr2, arr1);
|
|
506
|
+
return [].concat(diff1, diff2);
|
|
507
|
+
} catch (e) {
|
|
508
|
+
this.log_translator(
|
|
509
|
+
"warn",
|
|
510
|
+
"Error",
|
|
511
|
+
client,
|
|
512
|
+
`${JSON.stringify(arr1)} - ${JSON.stringify(arr2)} - ${JSON.stringify(from)}`,
|
|
513
|
+
);
|
|
514
|
+
return 0;
|
|
498
515
|
}
|
|
499
|
-
const diff1 = diff(arr1, arr2);
|
|
500
|
-
const diff2 = diff(arr2, arr1);
|
|
501
|
-
return [].concat(diff1, diff2);
|
|
502
516
|
},
|
|
503
517
|
/**
|
|
504
518
|
* @param {string} client device id
|
|
@@ -557,6 +571,7 @@ module.exports = {
|
|
|
557
571
|
mail.attachments = 0;
|
|
558
572
|
}
|
|
559
573
|
this.updatejson(mail, seqno, attrs, info, client, what);
|
|
574
|
+
stream.resume();
|
|
560
575
|
});
|
|
561
576
|
});
|
|
562
577
|
f.once("error", (error) => {
|
|
@@ -576,7 +591,7 @@ module.exports = {
|
|
|
576
591
|
* @param {string|object} box
|
|
577
592
|
*/
|
|
578
593
|
change_events(client, event, uid, box) {
|
|
579
|
-
this.
|
|
594
|
+
this.clients[client][event](uid, box, (err) => {
|
|
580
595
|
if (!err) {
|
|
581
596
|
this.log_translator("info", "SetFlag", `${JSON.stringify(uid)}: ${event} success`, client);
|
|
582
597
|
} else {
|
|
@@ -730,7 +745,6 @@ module.exports = {
|
|
|
730
745
|
*/
|
|
731
746
|
readAllMails(client, result, obj, count) {
|
|
732
747
|
const all_mails = [];
|
|
733
|
-
const mails = {};
|
|
734
748
|
let counter = 0;
|
|
735
749
|
return new Promise((resolve) => {
|
|
736
750
|
try {
|
|
@@ -744,6 +758,7 @@ module.exports = {
|
|
|
744
758
|
attrs = att;
|
|
745
759
|
});
|
|
746
760
|
msg.on("body", async (stream, info) => {
|
|
761
|
+
const mails = {};
|
|
747
762
|
if (obj.message.parse) {
|
|
748
763
|
mails["body"] = await simpleParser(stream);
|
|
749
764
|
} else {
|
|
@@ -755,6 +770,7 @@ module.exports = {
|
|
|
755
770
|
mails["user"] = client;
|
|
756
771
|
++counter;
|
|
757
772
|
all_mails.push(mails);
|
|
773
|
+
stream.resume();
|
|
758
774
|
if (count == counter) {
|
|
759
775
|
resolve(all_mails);
|
|
760
776
|
}
|
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
|
}
|
|
@@ -777,24 +787,25 @@ class Imap extends utils.Adapter {
|
|
|
777
787
|
*/
|
|
778
788
|
async setStatesValue(mail, seqno, clientID, count, attrs, info) {
|
|
779
789
|
try {
|
|
780
|
-
|
|
790
|
+
const id = `${clientID}.email.email_${("0" + count).slice(-2)}`;
|
|
791
|
+
await this.setStateAsync(`${id}.subject`, {
|
|
781
792
|
val: mail.subject != null ? mail.subject : this.helper_translator("Unknown"),
|
|
782
793
|
ack: true,
|
|
783
794
|
});
|
|
784
795
|
//const receive_date = mail.date.toISOString().replace("T", " ").replace(/\..+/, "");
|
|
785
|
-
await this.setStateAsync(`${
|
|
796
|
+
await this.setStateAsync(`${id}.receive`, {
|
|
786
797
|
val: mail.date != null ? mail.date.toString() : this.helper_translator("Unknown"),
|
|
787
798
|
ack: true,
|
|
788
799
|
});
|
|
789
|
-
await this.setStateAsync(`${
|
|
800
|
+
await this.setStateAsync(`${id}.content`, {
|
|
790
801
|
val: mail.html != null && mail.html ? mail.html : this.helper_translator("Unknown"),
|
|
791
802
|
ack: true,
|
|
792
803
|
});
|
|
793
|
-
await this.setStateAsync(`${
|
|
804
|
+
await this.setStateAsync(`${id}.text`, {
|
|
794
805
|
val: mail.text != null ? mail.text : this.helper_translator("Unknown"),
|
|
795
806
|
ack: true,
|
|
796
807
|
});
|
|
797
|
-
await this.setStateAsync(`${
|
|
808
|
+
await this.setStateAsync(`${id}.texthtml`, {
|
|
798
809
|
val: mail.textAsHtml != null ? mail.textAsHtml : this.helper_translator("Unknown"),
|
|
799
810
|
ack: true,
|
|
800
811
|
});
|
|
@@ -806,7 +817,7 @@ class Imap extends utils.Adapter {
|
|
|
806
817
|
}
|
|
807
818
|
}
|
|
808
819
|
}
|
|
809
|
-
await this.setStateAsync(`${
|
|
820
|
+
await this.setStateAsync(`${id}.to`, {
|
|
810
821
|
val: JSON.stringify(add),
|
|
811
822
|
ack: true,
|
|
812
823
|
});
|
|
@@ -818,32 +829,30 @@ class Imap extends utils.Adapter {
|
|
|
818
829
|
}
|
|
819
830
|
}
|
|
820
831
|
}
|
|
821
|
-
await this.setStateAsync(`${
|
|
832
|
+
await this.setStateAsync(`${id}.from`, {
|
|
822
833
|
val: JSON.stringify(add),
|
|
823
834
|
ack: true,
|
|
824
835
|
});
|
|
825
|
-
await this.setStateAsync(`${
|
|
826
|
-
val: attrs.flags != null ? JSON.stringify(attrs.flags) : "",
|
|
836
|
+
await this.setStateAsync(`${id}.flag`, {
|
|
837
|
+
val: attrs.flags != null ? JSON.stringify(attrs.flags) : this.helper_translator("Unknown"),
|
|
827
838
|
ack: true,
|
|
828
839
|
});
|
|
829
|
-
await this.setStateAsync(`${
|
|
840
|
+
await this.setStateAsync(`${id}.uid`, {
|
|
830
841
|
val: attrs.uid != null ? attrs.uid : 0,
|
|
831
842
|
ack: true,
|
|
832
843
|
});
|
|
833
|
-
await this.setStateAsync(`${
|
|
844
|
+
await this.setStateAsync(`${id}.seq`, {
|
|
834
845
|
val: seqno != null ? seqno : 0,
|
|
835
846
|
ack: true,
|
|
836
847
|
});
|
|
837
|
-
await this.setStateAsync(`${
|
|
848
|
+
await this.setStateAsync(`${id}.size`, {
|
|
838
849
|
val: info.size != null ? info.size : 0,
|
|
839
850
|
ack: true,
|
|
840
851
|
});
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
});
|
|
846
|
-
}
|
|
852
|
+
await this.setStateAsync(`${id}.attach`, {
|
|
853
|
+
val: mail.attachments != null ? mail.attachments : 0,
|
|
854
|
+
ack: true,
|
|
855
|
+
});
|
|
847
856
|
} catch (e) {
|
|
848
857
|
this.log_translator("error", "try", `setStatesValue: ${e}`);
|
|
849
858
|
}
|
|
@@ -1083,6 +1092,18 @@ class Imap extends utils.Adapter {
|
|
|
1083
1092
|
* @param {ioBroker.State | null | undefined} state
|
|
1084
1093
|
*/
|
|
1085
1094
|
async onStateChange(id, state) {
|
|
1095
|
+
if (state && state.ack) {
|
|
1096
|
+
const command = id.split(".").pop();
|
|
1097
|
+
if (command === "memRss") {
|
|
1098
|
+
if (
|
|
1099
|
+
typeof state.val === "number" &&
|
|
1100
|
+
state.val > this.config.max_mb &&
|
|
1101
|
+
this.config.max_mb_selection === 1
|
|
1102
|
+
) {
|
|
1103
|
+
this.memrsscheck();
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1086
1107
|
if (state && !state.ack) {
|
|
1087
1108
|
const command = id.split(".").pop();
|
|
1088
1109
|
const clientID = id.split(".")[2];
|
|
@@ -1131,7 +1152,7 @@ class Imap extends utils.Adapter {
|
|
|
1131
1152
|
}
|
|
1132
1153
|
if (command === "vis_command") {
|
|
1133
1154
|
if (state.val != "") {
|
|
1134
|
-
const value = state.val
|
|
1155
|
+
const value = state.val != null ? state.val.toString().split("<L>") : [];
|
|
1135
1156
|
if (value != null && value[0] != null && value[1] != null && value[2] != null) {
|
|
1136
1157
|
if (value[0] === "copy" || value[0] === "move") {
|
|
1137
1158
|
this.applyCopyMove(value[0], clientID, Number(value[1]), value[2]);
|
|
@@ -1174,7 +1195,11 @@ class Imap extends utils.Adapter {
|
|
|
1174
1195
|
if (this.save_json[clientID] && Object.keys(this.save_json[clientID]).length > 0) {
|
|
1175
1196
|
this.updateIMAPData(clientID, false, true);
|
|
1176
1197
|
} else {
|
|
1177
|
-
this.clients[clientID].
|
|
1198
|
+
if (this.clients[clientID].serverSupports("SORT")) {
|
|
1199
|
+
this.readMailsSort(clientID);
|
|
1200
|
+
} else {
|
|
1201
|
+
this.readMails(clientID);
|
|
1202
|
+
}
|
|
1178
1203
|
}
|
|
1179
1204
|
this.setAckFlag(id, { val: false });
|
|
1180
1205
|
}
|
|
@@ -1182,7 +1207,11 @@ class Imap extends utils.Adapter {
|
|
|
1182
1207
|
}
|
|
1183
1208
|
if (command === "reload_emails" && state.val) {
|
|
1184
1209
|
if (this.clients[clientID]) {
|
|
1185
|
-
this.clients[clientID].
|
|
1210
|
+
if (this.clients[clientID].serverSupports("SORT")) {
|
|
1211
|
+
this.readMailsSort(clientID);
|
|
1212
|
+
} else {
|
|
1213
|
+
this.readMails(clientID);
|
|
1214
|
+
}
|
|
1186
1215
|
this.setAckFlag(id, { val: false });
|
|
1187
1216
|
}
|
|
1188
1217
|
return;
|
|
@@ -1263,7 +1292,7 @@ class Imap extends utils.Adapter {
|
|
|
1263
1292
|
const folders = await this.getStateAsync(`${clientID}.remote.${command}.folder`);
|
|
1264
1293
|
folder = folders && folders.val ? folders.val.toString() : "";
|
|
1265
1294
|
}
|
|
1266
|
-
if (uid === 0) {
|
|
1295
|
+
if (uid === 0 || uid == null) {
|
|
1267
1296
|
const uids = await this.getStateAsync(`${clientID}.remote.${command}.uid`);
|
|
1268
1297
|
uid = uids && uids.val != null ? Number(uids.val) : 0;
|
|
1269
1298
|
}
|
|
@@ -1774,6 +1803,68 @@ class Imap extends utils.Adapter {
|
|
|
1774
1803
|
this.log_translator("error", "try", `cleanupQuality: ${e}`);
|
|
1775
1804
|
}
|
|
1776
1805
|
}
|
|
1806
|
+
|
|
1807
|
+
async memrsscheck() {
|
|
1808
|
+
const memrss = await this.getForeignStateAsync(`system.adapter.${this.namespace}.memRss`);
|
|
1809
|
+
const memrss_value = memrss != null && typeof memrss.val === "number" ? memrss.val : 0;
|
|
1810
|
+
if (memrss_value > this.config.max_mb) {
|
|
1811
|
+
if (this.config.max_mb_selection === 1) {
|
|
1812
|
+
const instances = this.config.max_mb_telegram.replace(/ /g, "").split(",");
|
|
1813
|
+
const instancesUser = this.config.max_mb_telegram_user.replace(/ /g, "").split(",");
|
|
1814
|
+
for (const instance of instances) {
|
|
1815
|
+
const text = this.helper_translator("Restart Adapter Text", memrss_value);
|
|
1816
|
+
const title = this.helper_translator("Restart Adapter Header");
|
|
1817
|
+
if (instancesUser.length > 0) {
|
|
1818
|
+
for (const user of instancesUser) {
|
|
1819
|
+
if (instance.includes("pushover")) {
|
|
1820
|
+
await this.sendToAsync(instance, {
|
|
1821
|
+
device: user,
|
|
1822
|
+
message: text,
|
|
1823
|
+
title: title,
|
|
1824
|
+
});
|
|
1825
|
+
} else if (instance.includes("signal-cmb")) {
|
|
1826
|
+
await this.sendToAsync(instance, "send", {
|
|
1827
|
+
text: text,
|
|
1828
|
+
phone: user,
|
|
1829
|
+
});
|
|
1830
|
+
} else {
|
|
1831
|
+
await this.sendToAsync(instance, { user: user, text: text });
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
} else {
|
|
1835
|
+
if (instance.includes("pushover")) {
|
|
1836
|
+
await this.sendToAsync(instance, { message: text, title: title });
|
|
1837
|
+
} else if (instance.includes("signal-cmb")) {
|
|
1838
|
+
await this.sendToAsync(instance, "send", {
|
|
1839
|
+
text: text,
|
|
1840
|
+
});
|
|
1841
|
+
} else {
|
|
1842
|
+
await this.sendToAsync(instance, text);
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
} else if (this.config.max_mb_selection === 2) {
|
|
1847
|
+
this.log_translator("info", "Restart Adapter", memrss_value, this.config.max_mb);
|
|
1848
|
+
//this.restart();
|
|
1849
|
+
try {
|
|
1850
|
+
await this.extendForeignObjectAsync(`system.adapter.${this.namespace}`, {
|
|
1851
|
+
native: { max_mb_last_restart: Date.now() },
|
|
1852
|
+
});
|
|
1853
|
+
} catch (e) {
|
|
1854
|
+
this.log_translator("info", "Adapter could not restart", e.message);
|
|
1855
|
+
}
|
|
1856
|
+
} else if (this.config.max_mb_selection === 3) {
|
|
1857
|
+
if (this.config.max_mb_object != "") {
|
|
1858
|
+
await this.setStateAsync(this.config.max_mb_object, true, false);
|
|
1859
|
+
this.log_translator("info", "Restart Adapter Text", memrss_value);
|
|
1860
|
+
} else {
|
|
1861
|
+
this.log_translator("info", "Restart Adapter Text NO DP", memrss_value);
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
} else {
|
|
1865
|
+
this.log_translator("info", "No threshold", memrss_value);
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1777
1868
|
}
|
|
1778
1869
|
|
|
1779
1870
|
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.8",
|
|
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.17.3",
|
|
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": [
|