Browse Source

Adapt Daemon and tracim config to use new email_fetcher

Guénaël Muller 7 years ago
parent
commit
67cb3dc68f

+ 7 - 0
tracim/development.ini.base View File

@@ -214,6 +214,13 @@ email.processing_mode = sync
214 214
 
215 215
 # Email reply configuration
216 216
 email.reply.activated = False
217
+email.reply.imap.server = your_imap_server
218
+email.reply.imap.port = 993
219
+email.reply.imap.user = your_imap_user
220
+email.reply.imap.password = your_imap_password
221
+email.reply.imap.folder = INBOX
222
+# Delay in seconds between each check
223
+email.reply.delay = 60
217 224
 
218 225
 ## Radical (CalDav server) configuration
219 226
 # radicale.server.host = 0.0.0.0

+ 19 - 0
tracim/tracim/config/app_cfg.py View File

@@ -352,6 +352,25 @@ class CFG(object):
352 352
             'email.reply.activated',
353 353
         ))
354 354
 
355
+        self.EMAIL_REPLY_IMAP_SERVER = tg.config.get(
356
+            'email.reply.imap.server',
357
+        )
358
+        self.EMAIL_REPLY_IMAP_PORT = tg.config.get(
359
+            'email.reply.imap.port',
360
+        )
361
+        self.EMAIL_REPLY_IMAP_USER = tg.config.get(
362
+            'email.reply.imap.user',
363
+        )
364
+        self.EMAIL_REPLY_IMAP_PASSWORD = tg.config.get(
365
+            'email.reply.imap.password',
366
+        )
367
+        self.EMAIL_REPLY_IMAP_FOLDER = tg.config.get(
368
+            'email.reply.imap.folder',
369
+        )
370
+        self.EMAIL_REPLY_DELAY = int(tg.config.get(
371
+            'email.reply.delay',
372
+        ))
373
+
355 374
         self.TRACKER_JS_PATH = tg.config.get(
356 375
             'js_tracker_path',
357 376
         )

+ 0 - 0
tracim/tracim/controllers/events.py View File


+ 15 - 3
tracim/tracim/lib/daemons.py View File

@@ -19,6 +19,7 @@ from tracim.lib.base import logger
19 19
 from tracim.lib.exceptions import AlreadyRunningDaemon
20 20
 
21 21
 from tracim.lib.utils import get_rq_queue
22
+from tracim.lib.email_fetcher import MailFetcher
22 23
 
23 24
 
24 25
 class DaemonsManager(object):
@@ -158,11 +159,22 @@ class MailFetcherDaemon(Daemon):
158 159
         self.ok = True
159 160
 
160 161
     def run(self):
161
-        while self.ok:
162
-            pass
162
+        from tracim.config.app_cfg import CFG
163
+        cfg = CFG.get_instance()
164
+        self._fetcher = MailFetcher(
165
+            host=cfg.EMAIL_REPLY_IMAP_SERVER,
166
+            port=cfg.EMAIL_REPLY_IMAP_PORT,
167
+            user=cfg.EMAIL_REPLY_IMAP_USER,
168
+            password=cfg.EMAIL_REPLY_IMAP_PASSWORD,
169
+            folder=cfg.EMAIL_REPLY_IMAP_FOLDER,
170
+            delay=cfg.EMAIL_REPLY_DELAY
171
+        )
172
+        self._fetcher.run()
163 173
 
164 174
     def stop(self):
165
-        self.ok = False
175
+        if self._fetcher:
176
+            self._fetcher.stop()
177
+
166 178
 
167 179
 
168 180