diff libervia/backend/plugins/plugin_comp_email_gateway/models.py @ 4386:c055042c01e3

component Email gateway: Convert mailing list to pubsub nodes: - `Credentials` is now a Pydantic based model. - Mailing list related emails are now detected hand saved as pubsub items, using XEP-0277 blog items, and creating suitable nodes. The ID of the mailing list is used for root node. - Mailing list items are currently restricted to recipient associated JID. - Words in square bracket in title `[Like][That]` are removed and converted to blog categories. - Method to convert between MbData and email (in both directions) have been created. rel 462
author Goffi <goffi@goffi.org>
date Sun, 03 Aug 2025 23:45:48 +0200
parents a7ec325246fb
children
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_comp_email_gateway/models.py	Sun Aug 03 23:45:45 2025 +0200
+++ b/libervia/backend/plugins/plugin_comp_email_gateway/models.py	Sun Aug 03 23:45:48 2025 +0200
@@ -17,11 +17,24 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from dataclasses import dataclass
-from typing import Any
+from pydantic import BaseModel, ConfigDict
 from twisted.mail import imap4
 
 
-Credentials = dict[str, Any]
+class Credentials(BaseModel):
+    model_config = ConfigDict(extra='forbid')
+    user_name: str
+    user_email: str
+    smtp_host: str
+    smtp_port: int
+    smtp_username: str
+    smtp_password: str
+    imap_success: bool = False
+    imap_host: str
+    imap_port: int
+    imap_username: str
+    imap_password: str
+
 
 
 @dataclass