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
 
214
 
215
 # Email reply configuration
215
 # Email reply configuration
216
 email.reply.activated = False
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
 ## Radical (CalDav server) configuration
225
 ## Radical (CalDav server) configuration
219
 # radicale.server.host = 0.0.0.0
226
 # radicale.server.host = 0.0.0.0

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

352
             'email.reply.activated',
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
         self.TRACKER_JS_PATH = tg.config.get(
374
         self.TRACKER_JS_PATH = tg.config.get(
356
             'js_tracker_path',
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
 from tracim.lib.exceptions import AlreadyRunningDaemon
19
 from tracim.lib.exceptions import AlreadyRunningDaemon
20
 
20
 
21
 from tracim.lib.utils import get_rq_queue
21
 from tracim.lib.utils import get_rq_queue
22
+from tracim.lib.email_fetcher import MailFetcher
22
 
23
 
23
 
24
 
24
 class DaemonsManager(object):
25
 class DaemonsManager(object):
158
         self.ok = True
159
         self.ok = True
159
 
160
 
160
     def run(self):
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
     def stop(self):
174
     def stop(self):
165
-        self.ok = False
175
+        if self._fetcher:
176
+            self._fetcher.stop()
177
+
166
 
178
 
167
 
179
 
168
 
180