選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

enigma.min.js 11KB

12345678910111213141516171819202122232425
  1. window.rcmail&&rcmail.addEventListener("init",function(a){"settings"==rcmail.env.task?(rcmail.gui_objects.keyslist&&(rcmail.keys_list=new rcube_list_widget(rcmail.gui_objects.keyslist,{multiselect:!0,draggable:!1,keyboard:!1}),rcmail.keys_list.addEventListener("select",function(a){rcmail.enigma_keylist_select(a)}).addEventListener("keypress",function(a){rcmail.enigma_keylist_keypress(a)}).init().focus(),rcmail.enigma_list(),rcmail.register_command("firstpage",function(a){return rcmail.enigma_list_page("first")}),
  2. rcmail.register_command("previouspage",function(a){return rcmail.enigma_list_page("previous")}),rcmail.register_command("nextpage",function(a){return rcmail.enigma_list_page("next")}),rcmail.register_command("lastpage",function(a){return rcmail.enigma_list_page("last")})),"plugin.enigmakeys"==rcmail.env.action&&(rcmail.register_command("search",function(a){return rcmail.enigma_search(a)},!0),rcmail.register_command("reset-search",function(a){return rcmail.enigma_search_reset(a)},!0),rcmail.register_command("plugin.enigma-import",
  3. function(){rcmail.enigma_import()},!0),rcmail.register_command("plugin.enigma-key-export",function(){rcmail.enigma_export()}),rcmail.register_command("plugin.enigma-key-export-selected",function(){rcmail.enigma_export(!0)}),rcmail.register_command("plugin.enigma-key-import",function(){rcmail.enigma_key_import()},!0),rcmail.register_command("plugin.enigma-key-delete",function(a){return rcmail.enigma_delete()}),rcmail.register_command("plugin.enigma-key-create",function(a){return rcmail.enigma_key_create()},
  4. !0),rcmail.register_command("plugin.enigma-key-save",function(a){return rcmail.enigma_key_create_save()},!0),rcmail.addEventListener("responseafterplugin.enigmakeys",function(){rcmail.enable_command("plugin.enigma-key-export",0<rcmail.env.rowcount)}))):"mail"==rcmail.env.task&&("compose"==rcmail.env.action&&(rcmail.addEventListener("beforesend",function(a){rcmail.enigma_beforesend_handler(a)}).addEventListener("beforesavedraft",function(a){rcmail.enigma_beforesavedraft_handler(a)}),$("input,label",
  5. $("#enigmamenu")).mouseup(function(a){a.stopPropagation()})),$.each(["encrypt","sign"],function(){rcmail.env["enigma_force_"+this]&&$('[name="_enigma_'+this+'"]').prop("checked",!0)}),rcmail.env.enigma_password_request&&rcmail.enigma_password_request(rcmail.env.enigma_password_request))});rcube_webmail.prototype.enigma_key_import=function(){this.enigma_loadframe("&_action=plugin.enigmakeys&_a=import")};rcube_webmail.prototype.enigma_key_create=function(){this.enigma_loadframe("&_action=plugin.enigmakeys&_a=create")};
  6. rcube_webmail.prototype.enigma_key_create_save=function(){var a,b;a=$("#key-ident > option").filter(":selected").text();var c=$("#key-pass").val(),d=$("#key-pass-confirm").val(),e=$("#key-size").val();if(!c||!d)return alert(this.get_label("enigma.formerror"));if(c!=d)return alert(this.get_label("enigma.passwordsdiffer"));if(a.match(/^<[^>]+>$/))return alert(this.get_label("enigma.nonameident"));window.openpgp&&window.crypto&&(window.crypto.getRandomValues||window.crypto.subtle)?(b=this.set_busy(!0,
  7. "enigma.keygenerating"),a={numBits:e,userId:a,passphrase:c},openpgp.generateKeyPair(a).then(function(a){rcmail.http_post("plugin.enigmakeys",{_a:"import",_keys:a.privateKeyArmored},b)},function(a){rcmail.set_busy(!1,null,b);rcmail.display_message(rcmail.get_label("enigma.keygenerateerror"),"error")})):rcmail.env.enigma_keygen_server?(b=this.set_busy(!0,"enigma.keygenerating"),a={_a:"generate",_user:a,_password:c,_size:e},rcmail.http_post("plugin.enigmakeys",a,b)):rcmail.display_message(rcmail.get_label("enigma.keygennosupport"),
  8. "error")};rcube_webmail.prototype.enigma_key_create_success=function(){parent.rcmail.enigma_list(1)};rcube_webmail.prototype.enigma_delete=function(){var a=this.keys_list.get_selection();if(a.length&&confirm(this.get_label("enigma.keyremoveconfirm"))){var b=this.display_message(this.get_label("enigma.keyremoving"),"loading");this.http_post("plugin.enigmakeys",{_a:"delete",_keys:a},b)}};
  9. rcube_webmail.prototype.enigma_export=function(a){var b=!1,c=this.keys_list;a=a?c.get_selection().join(","):"*";var d={_a:"export",_keys:a};if(a.length){"*"==a?b=!0:$.each(c.get_selection(),function(){if((flags=$(c.rows[this].obj).data("flags"))&&0<=flags.indexOf("p"))return b=!0,!1});if(b)return this.show_popup_dialog(this.get_label("enigma.keyexportprompt"),this.get_label("enigma.exportkeys"),[{text:this.get_label("enigma.onlypubkeys"),click:function(a){rcmail.goto_url("plugin.enigmakeys",d,!1,
  10. !0);$(this).remove()}},{text:this.get_label("enigma.withprivkeys"),click:function(a){d._priv=1;rcmail.goto_url("plugin.enigmakeys",d,!1,!0);$(this).remove()}}],{width:400});this.goto_url("plugin.enigmakeys",d,!1,!0)}};
  11. rcube_webmail.prototype.enigma_import=function(){var a,b;if(a=this.gui_objects.importform)(b=document.getElementById("rcmimportfile"))&&!b.value?alert(this.get_label("selectimportfile")):(b=this.set_busy(!0,"importwait"),a.action=this.add_url(a.action,"_unlock",b),a.submit(),this.lock_form(a,!0))};
  12. rcube_webmail.prototype.enigma_keylist_select=function(a){var b=a.get_single_selection(),c;b&&(c="&_action=plugin.enigmakeys&_a=info&_id="+b);this.enigma_loadframe(c);this.enable_command("plugin.enigma-key-delete","plugin.enigma-key-export-selected",0<a.selection.length)};
  13. rcube_webmail.prototype.enigma_keylist_keypress=function(a){a.modkey!=CONTROL_KEY&&(a.key_pressed==a.DELETE_KEY||a.key_pressed==a.BACKSPACE_KEY?this.command("plugin.enigma-key-delete"):33==a.key_pressed?this.command("previouspage"):34==a.key_pressed&&this.command("nextpage"))};
  14. rcube_webmail.prototype.enigma_loadframe=function(a){var b,c;this.env.contentframe&&window.frames&&(b=window.frames[this.env.contentframe])&&(!a&&(c=window.frames[this.env.contentframe])?c.location&&0>c.location.href.indexOf(this.env.blankpage)&&(c.location.href=this.env.blankpage):(this.env.frame_lock=this.set_busy(!0,"loading"),b.location.href=this.env.comm_path+"&_framed=1&"+a))};
  15. rcube_webmail.prototype.enigma_search=function(a){!a&&this.gui_objects.qsearchbox&&(a=this.gui_objects.qsearchbox.value);if(a||this.env.search_request){a={_a:"search",_q:urlencode(a)};var b=this.set_busy(!0,"searching");this.env.current_page=1;this.enigma_loadframe();this.enigma_clear_list();this.http_post("plugin.enigmakeys",a,b)}return!1};
  16. rcube_webmail.prototype.enigma_search_reset=function(a){a=this.env.search_request;this.reset_qsearch();a&&(this.enigma_loadframe(),this.enigma_clear_list(),this.enigma_list());return!1};rcube_webmail.prototype.enigma_list=function(a){var b={_a:"list"},c=this.set_busy(!0,"loading");this.env.current_page=a?a:1;this.env.search_request&&(b._q=this.env.search_request);a&&(b._p=a);this.enigma_clear_list();this.http_post("plugin.enigmakeys",b,c)};
  17. rcube_webmail.prototype.enigma_list_page=function(a){"next"==a?a=this.env.current_page+1:"last"==a?a=this.env.pagecount:"prev"==a&&1<this.env.current_page?a=this.env.current_page-1:"first"==a&&1<this.env.current_page&&(a=1);this.enigma_list(a)};rcube_webmail.prototype.enigma_clear_list=function(){this.enigma_loadframe();this.keys_list&&this.keys_list.clear(!0);this.enable_command("plugin.enigma-key-delete","plugin.enigma-key-delete-selected",!1)};
  18. rcube_webmail.prototype.enigma_add_list_row=function(a){if(!this.gui_objects.keyslist||!this.keys_list)return!1;var b=this.keys_list,c="message"+(this.gui_objects.keyslist.tBodies[0].rows.length%2?" even":" odd"),d=document.createElement("tr"),e=document.createElement("td");d.id="rcmrow"+a.id;d.className=c;a.flags&&$(d).data("flags",a.flags);e.innerHTML=a.name;d.appendChild(e);b.insert_row(d)};rcube_webmail.prototype.enigma_beforesend_handler=function(a){this.env.last_action="send";this.enigma_compose_handler(a)};
  19. rcube_webmail.prototype.enigma_beforesavedraft_handler=function(a){this.env.last_action="savedraft";this.enigma_compose_handler(a)};rcube_webmail.prototype.enigma_compose_handler=function(a){var b=this.gui_objects.messageform;$("#enigmamenu input").each(function(){var a=this.id+"_cpy",d=$("#"+a);d.length||(d=$(this).clone(),d.prop({id:a,type:"hidden"}).appendTo(b));d.val(this.checked?"1":"")});"savedraft"==this.env.last_action&&$('input[name="_enigma_sign"]',b).val(0)};
  20. rcube_webmail.prototype.enigma_import_attachment=function(a){var b=this.set_busy(!0,"loading");this.http_post("plugin.enigmaimport",{_uid:this.env.uid,_mbox:this.env.mailbox,_part:a},b);return!1};
  21. rcube_webmail.prototype.enigma_password_request=function(a){if(a&&a.keyid){var b=this,c=this.get_label("enigma.enterkeypass"),d=$('<div class="prompt">'),e=$('<div class="message">').appendTo(d),f=$("<input>").attr({type:"password",size:30}).keypress(function(a){13==a.which&&(b.is_framed()?window.parent.$:$)(".ui-dialog-buttonpane button.mainaction:visible").click()}).appendTo(d);a.key=a.keyid;8<a.keyid.length&&(a.keyid=a.keyid.substr(a.keyid.length-8));$.each(["keyid","user"],function(){c=c.replace("$"+
  22. this,a[this])});e.text(c);this.show_popup_dialog(d,this.get_label("enigma.enterkeypasstitle"),[{text:this.get_label("save"),"class":"mainaction",click:function(c){c.stopPropagation();c=b.is_framed()?window.parent.$:$;a.password=f.val();a.password?(b.enigma_password_submit(a),c(this).remove()):f.focus()}},{text:this.get_label("cancel"),click:function(a){var c=b.is_framed()?window.parent.$:$;a.stopPropagation();c(this).remove()}}],{width:400});this.is_framed()&&parent.rcmail.message_list&&parent.rcmail.message_list.blur()}};
  23. rcube_webmail.prototype.enigma_password_submit=function(a){if("compose"==this.env.action&&!a["compose-init"])return this.enigma_password_compose_submit(a);var b=this.set_busy(!0,"loading"),c=$("<form>").attr({method:"post",action:a.action||location.href,style:"display:none"}).append($("<input>").attr({type:"hidden",name:"_keyid",value:a.key})).append($("<input>").attr({type:"hidden",name:"_passwd",value:a.password})).append($("<input>").attr({type:"hidden",name:"_token",value:this.env.request_token})).append($("<input>").attr({type:"hidden",
  24. name:"_unlock",value:b}));$.each(a,function(a,b){0==a.indexOf("input")&&c.append($("<input>").attr({type:"hidden",name:a.substring(5),value:b}))});a.iframe&&(a="enigma_frame_"+(new Date).getTime(),$("<iframe>").attr({style:"display:none",name:a}).appendTo(document.body),c.attr("target",a));c.appendTo(document.body).submit()};
  25. rcube_webmail.prototype.enigma_password_compose_submit=function(a){var b=this.gui_objects.messageform;$('input[name="_keyid"]',b).length?($('input[name="_keyid"]',b).val(a.key),$('input[name="_passwd"]',b).val(a.password)):$(b).append($("<input>").attr({type:"hidden",name:"_keyid",value:a.key})).append($("<input>").attr({type:"hidden",name:"_passwd",value:a.password}));this.submit_messageform("savedraft"==this.env.last_action)};