diff options
| author | Raphael Collet <rco@openerp.com> | 2012-04-27 15:12:41 +0200 |
|---|---|---|
| committer | Raphael Collet <rco@openerp.com> | 2012-04-27 15:12:41 +0200 |
| commit | 33deda8f83dff5a510df8ef49522bbb9bb8ca7f6 (patch) | |
| tree | 91705d2f6c76e06f3b1b6b81f9ba91aedc06455e /addons/fetchmail | |
| parent | 1e7213e03b3572e4557f3390c4b1981b24dc1752 (diff) | |
| parent | 0ba09e28c93bce54f16c02a699c7747a28406318 (diff) | |
[MERGE] from trunk
bzr revid: rco@openerp.com-20120427131241-6gf7x3lzhux5qnnh
Diffstat (limited to 'addons/fetchmail')
| -rw-r--r-- | addons/fetchmail/__init__.py | 3 | ||||
| -rw-r--r-- | addons/fetchmail/fetchmail_view.xml | 7 | ||||
| -rw-r--r-- | addons/fetchmail/i18n/ja.po | 322 | ||||
| -rw-r--r-- | addons/fetchmail/res_config.py | 123 |
4 files changed, 451 insertions, 4 deletions
diff --git a/addons/fetchmail/__init__.py b/addons/fetchmail/__init__.py index 934df9846dd..7703c4d2f5b 100644 --- a/addons/fetchmail/__init__.py +++ b/addons/fetchmail/__init__.py @@ -1,7 +1,7 @@ #-*- coding:utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved # mga@tinyerp.com # @@ -21,5 +21,6 @@ ############################################################################## import fetchmail +import res_config # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/fetchmail/fetchmail_view.xml b/addons/fetchmail/fetchmail_view.xml index a9fb94553ed..3d9acf2bbd5 100644 --- a/addons/fetchmail/fetchmail_view.xml +++ b/addons/fetchmail/fetchmail_view.xml @@ -46,7 +46,7 @@ <group col="2" colspan="2"> <separator string="Actions to Perform on Incoming Mails" colspan="2"/> <field name="object_id" on_change="onchange_server_type(type, is_ssl, object_id)"/> - <field name="action_id" groups="base.group_extended"/> + <field name="action_id"/> </group> <group attrs="{'invisible' : [('type', '!=', 'local')]}" colspan="4" col="4"> <separator string="Configuration" colspan="4"/> @@ -54,10 +54,10 @@ <field name="script" colspan="4" widget="url"/> </group> </page> - <page string="Advanced" groups="base.group_extended"> + <page string="Advanced" groups="base.group_no_one"> <group colspan="2" col="2"> <separator string="Advanced options" colspan="2"/> - <field name="priority" groups="base.group_extended"/> + <field name="priority"/> <field name="attach"/> <field name="original"/> <field name="active" select="1"/> @@ -105,6 +105,7 @@ action="action_email_server_tree" name="Incoming Mail Servers" sequence="14" + groups="base.group_no_one" /> <record model="ir.ui.view" id="email_message_tree_view"> diff --git a/addons/fetchmail/i18n/ja.po b/addons/fetchmail/i18n/ja.po new file mode 100644 index 00000000000..0594d8f7327 --- /dev/null +++ b/addons/fetchmail/i18n/ja.po @@ -0,0 +1,322 @@ +# Japanese translation for openobject-addons +# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2012-02-08 00:36+0000\n" +"PO-Revision-Date: 2012-04-19 22:02+0000\n" +"Last-Translator: Masaki Yamaya <Unknown>\n" +"Language-Team: Japanese <ja@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2012-04-20 04:43+0000\n" +"X-Generator: Launchpad (build 15120)\n" + +#. module: fetchmail +#: selection:fetchmail.server,state:0 +msgid "Confirmed" +msgstr "確認済み" + +#. module: fetchmail +#: field:fetchmail.server,server:0 +msgid "Server Name" +msgstr "サーバ名" + +#. module: fetchmail +#: field:fetchmail.server,script:0 +msgid "Script" +msgstr "スクリプト" + +#. module: fetchmail +#: help:fetchmail.server,priority:0 +msgid "Defines the order of processing, lower values mean higher priority" +msgstr "処理の順序を定義します。値が小さいほど優先度が高い。" + +#. module: fetchmail +#: help:fetchmail.server,is_ssl:0 +msgid "" +"Connections are encrypted with SSL/TLS through a dedicated port (default: " +"IMAPS=993, POP3S=995)" +msgstr "専用ポートを使った接続によって SSL/TLS で暗号化されます (デフォルト:IMAPS=993, POP3S=995)。" + +#. module: fetchmail +#: field:fetchmail.server,attach:0 +msgid "Keep Attachments" +msgstr "添付を保持する。" + +#. module: fetchmail +#: help:fetchmail.server,original:0 +msgid "" +"Whether a full original copy of each email should be kept for referenceand " +"attached to each processed message. This will usually double the size of " +"your message database." +msgstr "Eメールの原本を保存して、処理済みメッセージを添付するかどうかの指定。これを指定すると、メッセージ・データベースのサイズが倍になります。" + +#. module: fetchmail +#: field:fetchmail.server,priority:0 +msgid "Server Priority" +msgstr "サーバの優先度" + +#. module: fetchmail +#: field:fetchmail.server,state:0 +msgid "State" +msgstr "状態" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "POP" +msgstr "POP" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Fetch Now" +msgstr "いま読み取る。" + +#. module: fetchmail +#: model:ir.actions.act_window,name:fetchmail.action_email_server_tree +#: model:ir.ui.menu,name:fetchmail.menu_action_fetchmail_server_tree +msgid "Incoming Mail Servers" +msgstr "Eメールサーバから読取り中" + +#. module: fetchmail +#: field:fetchmail.server,port:0 +msgid "Port" +msgstr "ポート" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "POP/IMAP Servers" +msgstr "POP/MAPサーバ" + +#. module: fetchmail +#: selection:fetchmail.server,type:0 +msgid "Local Server" +msgstr "ローカルサーバ" + +#. module: fetchmail +#: field:fetchmail.server,user:0 +msgid "Username" +msgstr "ユーザ名" + +#. module: fetchmail +#: model:ir.model,name:fetchmail.model_fetchmail_server +msgid "POP/IMAP Server" +msgstr "POP/IMAPサーバ" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Reset Confirmation" +msgstr "確認をリセット" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "SSL" +msgstr "SSL" + +#. module: fetchmail +#: model:ir.model,name:fetchmail.model_mail_message +msgid "Email Message" +msgstr "Eメールメッセージ" + +#. module: fetchmail +#: field:fetchmail.server,date:0 +msgid "Last Fetch Date" +msgstr "前回の読取り日" + +#. module: fetchmail +#: help:fetchmail.server,action_id:0 +msgid "" +"Optional custom server action to trigger for each incoming mail, on the " +"record that was created or updated by this mail" +msgstr "受信するEメールが作成したレコードによって、カスタムサーバの実行を起動するかどうかの選択" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "# of emails" +msgstr "Eメールの数" + +#. module: fetchmail +#: field:fetchmail.server,original:0 +msgid "Keep Original" +msgstr "原本を保持する" + +#. module: fetchmail +#: code:addons/fetchmail/fetchmail.py:155 +#, python-format +msgid "" +"Here is what we got instead:\n" +" %s" +msgstr "" +"代わりにこれを受け取りました:\n" +" %s" + +#. module: fetchmail +#: view:fetchmail.server:0 +#: field:fetchmail.server,configuration:0 +msgid "Configuration" +msgstr "設定" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Incoming Mail Server" +msgstr "受信Eメールサーバ" + +#. module: fetchmail +#: code:addons/fetchmail/fetchmail.py:155 +#, python-format +msgid "Connection test failed!" +msgstr "接続テストに失敗しました" + +#. module: fetchmail +#: help:fetchmail.server,server:0 +msgid "Hostname or IP of the mail server" +msgstr "ホスト名あるいはEメールサーバのIP" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Server type IMAP." +msgstr "サーバタイプ IMAP" + +#. module: fetchmail +#: field:fetchmail.server,name:0 +msgid "Name" +msgstr "名前" + +#. module: fetchmail +#: field:fetchmail.server,is_ssl:0 +msgid "SSL/TLS" +msgstr "SSL/TLS" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Test & Confirm" +msgstr "テスト・確認" + +#. module: fetchmail +#: field:fetchmail.server,action_id:0 +msgid "Server Action" +msgstr "サーバアクション" + +#. module: fetchmail +#: field:mail.message,fetchmail_server_id:0 +msgid "Inbound Mail Server" +msgstr "受信Eメールサーバ" + +#. module: fetchmail +#: field:fetchmail.server,message_ids:0 +#: model:ir.actions.act_window,name:fetchmail.act_server_history +msgid "Messages" +msgstr "メッセージ" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Search Incoming Mail Servers" +msgstr "受信Eメールサーバを検索する" + +#. module: fetchmail +#: field:fetchmail.server,active:0 +msgid "Active" +msgstr "活動中" + +#. module: fetchmail +#: help:fetchmail.server,attach:0 +msgid "" +"Whether attachments should be downloaded. If not enabled, incoming emails " +"will be stripped of any attachments before being processed" +msgstr "添付ファイルをダウンロードするかどうか。これを指定しないと,Eメールを受信する前に添付ファイアは外されます。" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Advanced options" +msgstr "高度なオプション" + +#. module: fetchmail +#: selection:fetchmail.server,type:0 +msgid "IMAP Server" +msgstr "IMAP サーバー" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "IMAP" +msgstr "IMAP" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Server type POP." +msgstr "サーバタイプPOP" + +#. module: fetchmail +#: field:fetchmail.server,password:0 +msgid "Password" +msgstr "パスワード" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Actions to Perform on Incoming Mails" +msgstr "受信Eメールに対する処理" + +#. module: fetchmail +#: field:fetchmail.server,type:0 +msgid "Server Type" +msgstr "サーバタイプ" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Login Information" +msgstr "ログイン情報" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Server Information" +msgstr "サーバ情報" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "If SSL required." +msgstr "SSLは必要ならば" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Advanced" +msgstr "高度" + +#. module: fetchmail +#: view:fetchmail.server:0 +msgid "Server & Login" +msgstr "サーバとログイン" + +#. module: fetchmail +#: help:fetchmail.server,object_id:0 +msgid "" +"Process each incoming mail as part of a conversation corresponding to this " +"document type. This will create new documents for new conversations, or " +"attach follow-up emails to the existing conversations (documents)." +msgstr "" +"受信Eメールを、この文書タイプに対応する交信の一部として処理する。\r\n" +"\r\n" +"そうすると、新しい交信のための新しい文書を作成するか、既存の交信(文書)への追跡Eメールを添付します。" + +#. module: fetchmail +#: field:fetchmail.server,object_id:0 +msgid "Create a New Record" +msgstr "新しいレコードを作成する" + +#. module: fetchmail +#: selection:fetchmail.server,state:0 +msgid "Not Confirmed" +msgstr "未確認" + +#. module: fetchmail +#: selection:fetchmail.server,type:0 +msgid "POP Server" +msgstr "POPサーバ" + +#. module: fetchmail +#: view:mail.message:0 +msgid "Mail Server" +msgstr "Eメールサーバ" diff --git a/addons/fetchmail/res_config.py b/addons/fetchmail/res_config.py new file mode 100644 index 00000000000..2b4072a63c3 --- /dev/null +++ b/addons/fetchmail/res_config.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Business Applications +# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +from osv import fields, osv + +class fetchmail_config_settings(osv.osv_memory): + """ This wizard can be inherited in conjunction with 'res.config.settings', in order to + define fields that configure a fetchmail server. + + It relies on the following convention on a set of fields:: + + class my_config_wizard(osv.osv_memory): + _name = 'my.settings' + _inherits = ['res.config.settings', 'fetchmail.config.settings'] + + _columns = { + 'fetchmail_X': fields.boolean(..., fetchmail_model='my.model', fetchmail_name='Blah'), + 'X_server': fields.char('Server Name', size=256), + 'X_port': fields.integer('Port'), + 'X_type': fields.selection( + [('pop', 'POP Server'), ('imap', 'IMAP Server'), ('local', 'Local Server')], + 'Server Type'), + 'X_is_ssl': fields.boolean('SSL/TLS'), + 'X_user': fields.char('Username', size=256), + 'X_password': fields.char('Password', size=1024), + } + + The method ``get_default_fetchmail_servers`` retrieves the current fetchmail configuration + for all fields that start with 'fetchmail_'. It looks up configurations that match the + given model name (``fetchmail_model``). The method ``set_fetchmail_servers`` updates the + fetchmail configurations by following the same conventions. Both methods are called + automatically by the methods of the model 'res.config.settings'. + + The onchange method ``onchange_fetchmail`` can be used to react on changes on the fields + 'X_type' and 'X_is_ssl'. Its first parameter is the fields' prefix (here 'X'). + """ + _name = 'fetchmail.config.settings' + + def get_default_fetchmail_servers(self, cr, uid, fields, context=None): + ir_model = self.pool.get('ir.model') + fetchmail_server = self.pool.get('fetchmail.server') + fetchmail_fields = [f for f in self._columns if f.startswith('fetchmail_')] + res = {} + for field in fetchmail_fields: + model_name = self._columns[field].fetchmail_model + model_id = ir_model.search(cr, uid, [('model', '=', model_name)])[0] + server_ids = fetchmail_server.search(cr, uid, [('object_id', '=', model_id), ('state', '=', 'done')]) + if server_ids: + server = fetchmail_server.browse(cr, uid, server_ids[0], context) + prefix = field[10:] + res.update({ + field: True, + prefix + '_server': server.server, + prefix + '_port': server.port, + prefix + '_type': server.type, + prefix + '_is_ssl': server.is_ssl, + prefix + '_user': server.user, + prefix + '_password': server.password, + }) + return res + + def set_fetchmail_servers(self, cr, uid, ids, context): + ir_model = self.pool.get('ir.model') + fetchmail_server = self.pool.get('fetchmail.server') + fetchmail_fields = [f for f in self._columns if f.startswith('fetchmail_')] + config = self.browse(cr, uid, ids[0], context) + for field in fetchmail_fields: + model_name = self._columns[field].fetchmail_model + model_id = ir_model.search(cr, uid, [('model', '=', model_name)])[0] + server_ids = fetchmail_server.search(cr, uid, [('object_id', '=', model_id), ('state', '=', 'done')]) + if config[field]: + prefix = field[10:] + values = { + 'server': config[prefix + '_server'], + 'port': config[prefix + '_port'], + 'type': config[prefix + '_type'], + 'is_ssl': config[prefix + '_is_ssl'], + 'user': config[prefix + '_user'], + 'password': config[prefix + '_password'], + } + if not server_ids: + values.update({ + 'name': getattr(self._columns[field], 'fetchmail_name', model_name), + 'object_id': model_id, + }) + server_ids = [fetchmail_server.create(cr, uid, values, context=context)] + else: + server_ids = fetchmail_server.search(cr, uid, [('object_id', '=', model_id)], context=context) + fetchmail_server.write(cr, uid, server_ids, values, context=context) + fetchmail_server.button_confirm_login(cr, uid, server_ids, context) + else: + fetchmail_server.set_draft(cr, uid, server_ids, context) + + def onchange_fetchmail(self, cr, uid, ids, prefix, server_type, ssl, context=None): + values = {} + if server_type == 'pop': + values[prefix + '_port'] = ssl and 995 or 110 + elif server_type == 'imap': + values[prefix + '_port'] = ssl and 993 or 143 + else: + values[prefix + '_server'] = False + values[prefix + '_port'] = 0 + return {'value': values} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
