def _run_userscript(self, new_mails): config = self.get_config() script_file = config['script_file'].strip() if (len(script_file) > 0) and os.path.exists(script_file): script_args = [ script_file, str(len(new_mails)) ] for m in new_mails: sender_name, sender_addr = m.sender if len(sender_addr) == 0: sender_addr = 'UNKNOWN_SENDER' script_args.append(sender_addr) script_args.append(m.subject) start_subprocess(script_args)
def _run_userscript(self, new_mails): config = self.get_config() script_file = config['script_file'].strip() if (len(script_file) > 0) and os.path.exists(script_file): script_args = [script_file, str(len(new_mails))] for m in new_mails: sender_name, sender_addr = m.sender if len(sender_addr) == 0: sender_addr = 'UNKNOWN_SENDER' script_args.append(m.account_name) script_args.append(sender_addr) script_args.append(m.subject) start_subprocess(script_args)
def _notification_action_handler(self, n, action, user_data): with self._lock: if action == "default": mailclient = get_default_mail_reader() if mailclient != None: start_subprocess(mailclient) # clicking the notification bubble has closed all notifications # so clear the reference array as well. self._notifications = {} elif action == "mark-as-read": controller = self.get_mailnag_controller() try: controller.mark_mail_as_read(user_data[0].id) except InvalidOperationException: pass # clicking the action has closed the notification # so remove its reference. del self._notifications[user_data[1]]