{"action":"created","comment":{"url":"https://api.github.com/repos/friendica/friendica-addons/pulls/comments/111535958","pull_request_review_id":32789589,"id":111535958,"diff_hunk":"@@ -1,92 +1,175 @@\n-<?php\r\n-/**\r\n- * Name: Secure Mail\r\n- * Description: Send notification mail encrypted with user-defined public GPG key\r\n- * Version: 1.0\r\n- * Author: Fabio Comuni <http://kirgroup.com/profile/fabrixxm>\r\n- */\r\n- require_once 'php-gpg/libs/GPG.php';\r\n-\r\n- function securemail_install() {\r\n-    register_hook('plugin_settings', 'addon/securemail/securemail.php', 'securemail_settings');\r\n-    register_hook('plugin_settings_post', 'addon/securemail/securemail.php', 'securemail_settings_post');\r\n-\r\n-    register_hook('emailer_send_prepare',  'addon/securemail/securemail.php', 'securemail_emailer_send_prepare');\r\n-\r\n-    logger(\"installed securemail\");\r\n-}\r\n-\r\n-function securemail_uninstall() {\r\n-    unregister_hook('plugin_settings', 'addon/securemail/securemail.php', 'securemail_settings');\r\n-    unregister_hook('plugin_settings_post', 'addon/securemail/securemail.php', 'securemail_settings_post');\r\n-\r\n-    unregister_hook('emailer_send_prepare',  'addon/securemail/securemail.php', 'securemail_emailer_send_prepare');\r\n-\r\n-    logger(\"removed securemail\");\r\n-}\r\n-\r\n-\r\n-function securemail_settings(&$a,&$s){\r\n-    if(! local_user())\r\n-\t    return;\r\n-\r\n-    $enable_checked = (intval(get_pconfig(local_user(),'securemail','enable')) ? ' checked=\"checked\"' : '');\r\n-    $publickey = get_pconfig(local_user(),'securemail','pkey');\r\n-\r\n-    # all of this should be in a template...\r\n-    $s .= '<span id=\"settings_securemail_inflated\" class=\"settings-block fakelink\" style=\"display: block;\" onclick=\"openClose(\\'settings_securemail_expanded\\'); openClose(\\'settings_securemail_inflated\\');\">';\r\n-    $s .= '<h3>' . t('\"Secure Mail\" Settings').'</h3>';\r\n-    $s .= '</span>';\r\n-    $s .= '<div id=\"settings_securemail_expanded\" class=\"settings-block\" style=\"display: none;\">';\r\n-    $s .= '<span class=\"fakelink\" onclick=\"openClose(\\'settings_securemail_expanded\\'); openClose(\\'settings_securemail_inflated\\');\">';\r\n-    $s .= '<h3>' . t('\"Secure Mail\" Settings').'</h3>';\r\n-    $s .= '</span>';\r\n-    $s .= '<div id=\"securemail-wrapper\">';\r\n-\r\n-    $s .= '<input id=\"securemail-enable\" type=\"checkbox\" name=\"securemail-enable\" value=\"1\"'.$enable_checked.' />';\r\n-    $s .= '<label id=\"securemail-enable-label\" for=\"securemail-enable\">'.t('Enable Secure Mail').'</label>';\r\n-\r\n-    $s .= '<div class=\"clear\"></div>';\r\n-    $s .= '<label id=\"securemail-label\" for=\"securemail-pkey\">'.t('Public key').' </label>';\r\n-    $s .= '<textarea id=\"securemail-pkey\" name=\"securemail-pkey\">'.$publickey.'</textarea>';\r\n-    $s .= '</div><div class=\"clear\"></div>';\r\n-\r\n-    $s .= '<div class=\"settings-submit-wrapper\" ><input type=\"submit\" id=\"securemail-submit\" name=\"securemail-submit\" class=\"settings-submit\" value=\"' . t('Save Settings') . '\" /></div>';\r\n-    $s .= '</div>';\r\n-\r\n-    return;\r\n-}\r\n-function securemail_settings_post(&$a, &$b){\r\n-\r\n-    if(! local_user())\r\n-        return;\r\n-\r\n-    if($_POST['securemail-submit']) {\r\n-\t\tset_pconfig(local_user(),'securemail','pkey',trim($_POST['securemail-pkey']));\r\n-\t\t$enable = ((x($_POST,'securemail-enable')) ? 1 : 0);\r\n-\t\tset_pconfig(local_user(),'securemail','enable', $enable);\r\n-\t\tinfo( t('Secure Mail Settings saved.') . EOL);\r\n-    }\r\n-}\r\n-\r\n-function securemail_emailer_send_prepare(&$a, &$b) {\r\n-    if (!x($b,'uid')) return;\r\n-\t$uid = $b['uid'];\r\n-\r\n-    $enable_checked = get_pconfig($uid,'securemail','enable');\r\n-    if (!$enable_checked) return;\r\n-\r\n-    $public_key_ascii = get_pconfig($uid,'securemail','pkey');\r\n-\r\n-    $gpg = new GPG();\r\n-\r\n-    # create an instance of a GPG public key object based on ASCII key\r\n-    $pub_key = new GPG_Public_Key($public_key_ascii);\r\n-\r\n-    # using the key, encrypt your plain text using the public key\r\n-    $txt_encrypted = $gpg->encrypt($pub_key,$b['textVersion']);\r\n-    #$html_encrypted = $gpg->encrypt($pub_key,$b['htmlVersion']);\r\n-\r\n-    $b['textVersion'] = $txt_encrypted;\r\n-    $b['htmlVersion'] = null;\r\n-}\r\n+<?php\n+/**\n+ * Name: Secure Mail\n+ * Description: Send notification mail encrypted with user-defined public GPG key\n+ * Version: 2.0\n+ * Author: Fabio Comuni <http://kirgroup.com/profile/fabrixxm>\n+ */\n+\n+require_once \"include/Emailer.php\";\n+\n+/* because the fraking openpgp-php is in composer, require libs in composer\n+ * and then don't use autoloader to load classes... */\n+$path = __DIR__.\"/vendor/phpseclib/phpseclib/phpseclib/\";\n+set_include_path(get_include_path() . PATH_SEPARATOR . $path);\n+/* so, we don't use the autoloader and include what we need */\n+$path = __DIR__.\"/vendor/singpolyma/openpgp-php/lib\";\n+set_include_path(get_include_path() . PATH_SEPARATOR . $path);\n+\n+require_once \"openpgp.php\";\n+require_once \"openpgp_crypt_symmetric.php\";\n+\n+\n+function securemail_install() {\n+    register_hook('plugin_settings', 'addon/securemail/securemail.php', 'securemail_settings');\n+    register_hook('plugin_settings_post', 'addon/securemail/securemail.php', 'securemail_settings_post');\n+\n+    register_hook('emailer_send_prepare',  'addon/securemail/securemail.php', 'securemail_emailer_send_prepare');\n+\n+    logger(\"installed securemail\");\n+}\n+\n+function securemail_uninstall() {\n+    unregister_hook('plugin_settings', 'addon/securemail/securemail.php', 'securemail_settings');\n+    unregister_hook('plugin_settings_post', 'addon/securemail/securemail.php', 'securemail_settings_post');\n+\n+    unregister_hook('emailer_send_prepare',  'addon/securemail/securemail.php', 'securemail_emailer_send_prepare');\n+\n+    logger(\"removed securemail\");\n+}\n+\n+\n+function securemail_settings(&$a,&$s){","path":"securemail/securemail.php","position":134,"original_position":134,"commit_id":"c91b574f3a68a69e2a3161bd21a5c1d91c0fa572","original_commit_id":"c91b574f3a68a69e2a3161bd21a5c1d91c0fa572","user":{"login":"fabrixxm","id":309361,"avatar_url":"https://avatars0.githubusercontent.com/u/309361?v=3","gravatar_id":"","url":"https://api.github.com/users/fabrixxm","html_url":"https://github.com/fabrixxm","followers_url":"https://api.github.com/users/fabrixxm/followers","following_url":"https://api.github.com/users/fabrixxm/following{/other_user}","gists_url":"https://api.github.com/users/fabrixxm/gists{/gist_id}","starred_url":"https://api.github.com/users/fabrixxm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabrixxm/subscriptions","organizations_url":"https://api.github.com/users/fabrixxm/orgs","repos_url":"https://api.github.com/users/fabrixxm/repos","events_url":"https://api.github.com/users/fabrixxm/events{/privacy}","received_events_url":"https://api.github.com/users/fabrixxm/received_events","type":"User","site_admin":false},"body":"docs for those functions should links hooks docs, as are all hooks callbacks. Is there a way to do that?","created_at":"2017-04-14T06:41:08Z","updated_at":"2017-04-14T06:41:09Z","html_url":"https://github.com/friendica/friendica-addons/pull/410#discussion_r111535958","pull_request_url":"https://api.github.com/repos/friendica/friendica-addons/pulls/410","_links":{"self":{"href":"https://api.github.com/repos/friendica/friendica-addons/pulls/comments/111535958"},"html":{"href":"https://github.com/friendica/friendica-addons/pull/410#discussion_r111535958"},"pull_request":{"href":"https://api.github.com/repos/friendica/friendica-addons/pulls/410"}}},"pull_request":{"url":"https://api.github.com/repos/friendica/friendica-addons/pulls/410","id":115395597,"html_url":"https://github.com/friendica/friendica-addons/pull/410","diff_url":"https://github.com/friendica/friendica-addons/pull/410.diff","patch_url":"https://github.com/friendica/friendica-addons/pull/410.patch","issue_url":"https://api.github.com/repos/friendica/friendica-addons/issues/410","number":410,"state":"open","locked":false,"title":"Secure Mail 2.0","user":{"login":"fabrixxm","id":309361,"avatar_url":"https://avatars0.githubusercontent.com/u/309361?v=3","gravatar_id":"","url":"https://api.github.com/users/fabrixxm","html_url":"https://github.com/fabrixxm","followers_url":"https://api.github.com/users/fabrixxm/followers","following_url":"https://api.github.com/users/fabrixxm/following{/other_user}","gists_url":"https://api.github.com/users/fabrixxm/gists{/gist_id}","starred_url":"https://api.github.com/users/fabrixxm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabrixxm/subscriptions","organizations_url":"https://api.github.com/users/fabrixxm/orgs","repos_url":"https://api.github.com/users/fabrixxm/repos","events_url":"https://api.github.com/users/fabrixxm/events{/privacy}","received_events_url":"https://api.github.com/users/fabrixxm/received_events","type":"User","site_admin":false},"body":"Remove php-gpg, add openpgp-php and phpseclib.\r\nAdd template file for settings.\r\nAdd \"send test\" functionality.\r\nAdd messages.po","created_at":"2017-04-11T19:25:18Z","updated_at":"2017-04-14T06:41:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"191c6cc0aa698dcdb6baad3f449517fe0d273a21","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/friendica/friendica-addons/pulls/410/commits","review_comments_url":"https://api.github.com/repos/friendica/friendica-addons/pulls/410/comments","review_comment_url":"https://api.github.com/repos/friendica/friendica-addons/pulls/comments{/number}","comments_url":"https://api.github.com/repos/friendica/friendica-addons/issues/410/comments","statuses_url":"https://api.github.com/repos/friendica/friendica-addons/statuses/c91b574f3a68a69e2a3161bd21a5c1d91c0fa572","head":{"label":"fabrixxm:securemail-2.0","ref":"securemail-2.0","sha":"c91b574f3a68a69e2a3161bd21a5c1d91c0fa572","user":{"login":"fabrixxm","id":309361,"avatar_url":"https://avatars0.githubusercontent.com/u/309361?v=3","gravatar_id":"","url":"https://api.github.com/users/fabrixxm","html_url":"https://github.com/fabrixxm","followers_url":"https://api.github.com/users/fabrixxm/followers","following_url":"https://api.github.com/users/fabrixxm/following{/other_user}","gists_url":"https://api.github.com/users/fabrixxm/gists{/gist_id}","starred_url":"https://api.github.com/users/fabrixxm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabrixxm/subscriptions","organizations_url":"https://api.github.com/users/fabrixxm/orgs","repos_url":"https://api.github.com/users/fabrixxm/repos","events_url":"https://api.github.com/users/fabrixxm/events{/privacy}","received_events_url":"https://api.github.com/users/fabrixxm/received_events","type":"User","site_admin":false},"repo":{"id":3400150,"name":"friendica-addons","full_name":"fabrixxm/friendica-addons","owner":{"login":"fabrixxm","id":309361,"avatar_url":"https://avatars0.githubusercontent.com/u/309361?v=3","gravatar_id":"","url":"https://api.github.com/users/fabrixxm","html_url":"https://github.com/fabrixxm","followers_url":"https://api.github.com/users/fabrixxm/followers","following_url":"https://api.github.com/users/fabrixxm/following{/other_user}","gists_url":"https://api.github.com/users/fabrixxm/gists{/gist_id}","starred_url":"https://api.github.com/users/fabrixxm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabrixxm/subscriptions","organizations_url":"https://api.github.com/users/fabrixxm/orgs","repos_url":"https://api.github.com/users/fabrixxm/repos","events_url":"https://api.github.com/users/fabrixxm/events{/privacy}","received_events_url":"https://api.github.com/users/fabrixxm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fabrixxm/friendica-addons","description":null,"fork":true,"url":"https://api.github.com/repos/fabrixxm/friendica-addons","forks_url":"https://api.github.com/repos/fabrixxm/friendica-addons/forks","keys_url":"https://api.github.com/repos/fabrixxm/friendica-addons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fabrixxm/friendica-addons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fabrixxm/friendica-addons/teams","hooks_url":"https://api.github.com/repos/fabrixxm/friendica-addons/hooks","issue_events_url":"https://api.github.com/repos/fabrixxm/friendica-addons/issues/events{/number}","events_url":"https://api.github.com/repos/fabrixxm/friendica-addons/events","assignees_url":"https://api.github.com/repos/fabrixxm/friendica-addons/assignees{/user}","branches_url":"https://api.github.com/repos/fabrixxm/friendica-addons/branches{/branch}","tags_url":"https://api.github.com/repos/fabrixxm/friendica-addons/tags","blobs_url":"https://api.github.com/repos/fabrixxm/friendica-addons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fabrixxm/friendica-addons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fabrixxm/friendica-addons/git/refs{/sha}","trees_url":"https://api.github.com/repos/fabrixxm/friendica-addons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fabrixxm/friendica-addons/statuses/{sha}","languages_url":"https://api.github.com/repos/fabrixxm/friendica-addons/languages","stargazers_url":"https://api.github.com/repos/fabrixxm/friendica-addons/stargazers","contributors_url":"https://api.github.com/repos/fabrixxm/friendica-addons/contributors","subscribers_url":"https://api.github.com/repos/fabrixxm/friendica-addons/subscribers","subscription_url":"https://api.github.com/repos/fabrixxm/friendica-addons/subscription","commits_url":"https://api.github.com/repos/fabrixxm/friendica-addons/commits{/sha}","git_commits_url":"https://api.github.com/repos/fabrixxm/friendica-addons/git/commits{/sha}","comments_url":"https://api.github.com/repos/fabrixxm/friendica-addons/comments{/number}","issue_comment_url":"https://api.github.com/repos/fabrixxm/friendica-addons/issues/comments{/number}","contents_url":"https://api.github.com/repos/fabrixxm/friendica-addons/contents/{+path}","compare_url":"https://api.github.com/repos/fabrixxm/friendica-addons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fabrixxm/friendica-addons/merges","archive_url":"https://api.github.com/repos/fabrixxm/friendica-addons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fabrixxm/friendica-addons/downloads","issues_url":"https://api.github.com/repos/fabrixxm/friendica-addons/issues{/number}","pulls_url":"https://api.github.com/repos/fabrixxm/friendica-addons/pulls{/number}","milestones_url":"https://api.github.com/repos/fabrixxm/friendica-addons/milestones{/number}","notifications_url":"https://api.github.com/repos/fabrixxm/friendica-addons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fabrixxm/friendica-addons/labels{/name}","releases_url":"https://api.github.com/repos/fabrixxm/friendica-addons/releases{/id}","deployments_url":"https://api.github.com/repos/fabrixxm/friendica-addons/deployments","created_at":"2012-02-09T19:07:26Z","updated_at":"2015-02-09T11:01:20Z","pushed_at":"2017-04-11T19:23:28Z","git_url":"git://github.com/fabrixxm/friendica-addons.git","ssh_url":"git@github.com:fabrixxm/friendica-addons.git","clone_url":"https://github.com/fabrixxm/friendica-addons.git","svn_url":"https://github.com/fabrixxm/friendica-addons","homepage":"","size":52586,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"friendica:master","ref":"master","sha":"02b2fe9b1082c84d49582c4bc1dc4d746c12fc45","user":{"login":"friendica","id":1176581,"avatar_url":"https://avatars2.githubusercontent.com/u/1176581?v=3","gravatar_id":"","url":"https://api.github.com/users/friendica","html_url":"https://github.com/friendica","followers_url":"https://api.github.com/users/friendica/followers","following_url":"https://api.github.com/users/friendica/following{/other_user}","gists_url":"https://api.github.com/users/friendica/gists{/gist_id}","starred_url":"https://api.github.com/users/friendica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/friendica/subscriptions","organizations_url":"https://api.github.com/users/friendica/orgs","repos_url":"https://api.github.com/users/friendica/repos","events_url":"https://api.github.com/users/friendica/events{/privacy}","received_events_url":"https://api.github.com/users/friendica/received_events","type":"User","site_admin":false},"repo":{"id":2722720,"name":"friendica-addons","full_name":"friendica/friendica-addons","owner":{"login":"friendica","id":1176581,"avatar_url":"https://avatars2.githubusercontent.com/u/1176581?v=3","gravatar_id":"","url":"https://api.github.com/users/friendica","html_url":"https://github.com/friendica","followers_url":"https://api.github.com/users/friendica/followers","following_url":"https://api.github.com/users/friendica/following{/other_user}","gists_url":"https://api.github.com/users/friendica/gists{/gist_id}","starred_url":"https://api.github.com/users/friendica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/friendica/subscriptions","organizations_url":"https://api.github.com/users/friendica/orgs","repos_url":"https://api.github.com/users/friendica/repos","events_url":"https://api.github.com/users/friendica/events{/privacy}","received_events_url":"https://api.github.com/users/friendica/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/friendica/friendica-addons","description":null,"fork":true,"url":"https://api.github.com/repos/friendica/friendica-addons","forks_url":"https://api.github.com/repos/friendica/friendica-addons/forks","keys_url":"https://api.github.com/repos/friendica/friendica-addons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/friendica/friendica-addons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/friendica/friendica-addons/teams","hooks_url":"https://api.github.com/repos/friendica/friendica-addons/hooks","issue_events_url":"https://api.github.com/repos/friendica/friendica-addons/issues/events{/number}","events_url":"https://api.github.com/repos/friendica/friendica-addons/events","assignees_url":"https://api.github.com/repos/friendica/friendica-addons/assignees{/user}","branches_url":"https://api.github.com/repos/friendica/friendica-addons/branches{/branch}","tags_url":"https://api.github.com/repos/friendica/friendica-addons/tags","blobs_url":"https://api.github.com/repos/friendica/friendica-addons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/friendica/friendica-addons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/friendica/friendica-addons/git/refs{/sha}","trees_url":"https://api.github.com/repos/friendica/friendica-addons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/friendica/friendica-addons/statuses/{sha}","languages_url":"https://api.github.com/repos/friendica/friendica-addons/languages","stargazers_url":"https://api.github.com/repos/friendica/friendica-addons/stargazers","contributors_url":"https://api.github.com/repos/friendica/friendica-addons/contributors","subscribers_url":"https://api.github.com/repos/friendica/friendica-addons/subscribers","subscription_url":"https://api.github.com/repos/friendica/friendica-addons/subscription","commits_url":"https://api.github.com/repos/friendica/friendica-addons/commits{/sha}","git_commits_url":"https://api.github.com/repos/friendica/friendica-addons/git/commits{/sha}","comments_url":"https://api.github.com/repos/friendica/friendica-addons/comments{/number}","issue_comment_url":"https://api.github.com/repos/friendica/friendica-addons/issues/comments{/number}","contents_url":"https://api.github.com/repos/friendica/friendica-addons/contents/{+path}","compare_url":"https://api.github.com/repos/friendica/friendica-addons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/friendica/friendica-addons/merges","archive_url":"https://api.github.com/repos/friendica/friendica-addons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/friendica/friendica-addons/downloads","issues_url":"https://api.github.com/repos/friendica/friendica-addons/issues{/number}","pulls_url":"https://api.github.com/repos/friendica/friendica-addons/pulls{/number}","milestones_url":"https://api.github.com/repos/friendica/friendica-addons/milestones{/number}","notifications_url":"https://api.github.com/repos/friendica/friendica-addons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/friendica/friendica-addons/labels{/name}","releases_url":"https://api.github.com/repos/friendica/friendica-addons/releases{/id}","deployments_url":"https://api.github.com/repos/friendica/friendica-addons/deployments","created_at":"2011-11-06T22:21:11Z","updated_at":"2016-11-10T18:28:01Z","pushed_at":"2017-04-11T19:25:18Z","git_url":"git://github.com/friendica/friendica-addons.git","ssh_url":"git@github.com:friendica/friendica-addons.git","clone_url":"https://github.com/friendica/friendica-addons.git","svn_url":"https://github.com/friendica/friendica-addons","homepage":"","size":52309,"stargazers_count":66,"watchers_count":66,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":65,"mirror_url":null,"open_issues_count":1,"forks":65,"open_issues":1,"watchers":66,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/friendica/friendica-addons/pulls/410"},"html":{"href":"https://github.com/friendica/friendica-addons/pull/410"},"issue":{"href":"https://api.github.com/repos/friendica/friendica-addons/issues/410"},"comments":{"href":"https://api.github.com/repos/friendica/friendica-addons/issues/410/comments"},"review_comments":{"href":"https://api.github.com/repos/friendica/friendica-addons/pulls/410/comments"},"review_comment":{"href":"https://api.github.com/repos/friendica/friendica-addons/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/friendica/friendica-addons/pulls/410/commits"},"statuses":{"href":"https://api.github.com/repos/friendica/friendica-addons/statuses/c91b574f3a68a69e2a3161bd21a5c1d91c0fa572"}}}}
{"actor":{"display_login":"fabrixxm"}}