recovered [mailstream] various modernisations

These changes where made on github as #1354 but got lost due mirroring
issued from the development branch. Original author is mexon.

https://github.com/friendica/friendica-addons/pull/1354
remotes/1696060291408326892/develop
Tobias Diekershoff 2023-04-27 07:21:20 +02:00
parent dac297b942
commit b34c9131ca
9 changed files with 131 additions and 143 deletions

View File

@ -29,68 +29,72 @@ msgstr ""
msgid "Save Settings" msgid "Save Settings"
msgstr "" msgstr ""
#: mailstream.php:301 #: mailstream.php:311
msgid "Re:" msgid "Re:"
msgstr "" msgstr ""
#: mailstream.php:314 mailstream.php:317 #: mailstream.php:324 mailstream.php:327
msgid "Friendica post" msgid "Friendica post"
msgstr "" msgstr ""
#: mailstream.php:320 #: mailstream.php:330
msgid "Diaspora post" msgid "Diaspora post"
msgstr "" msgstr ""
#: mailstream.php:330 #: mailstream.php:340
msgid "Feed item" msgid "Feed item"
msgstr "" msgstr ""
#: mailstream.php:333 #: mailstream.php:343
msgid "Email" msgid "Email"
msgstr "" msgstr ""
#: mailstream.php:335 #: mailstream.php:345
msgid "Friendica Item" msgid "Friendica Item"
msgstr "" msgstr ""
#: mailstream.php:404 #: mailstream.php:419
msgid "Upstream" msgid "Upstream"
msgstr "" msgstr ""
#: mailstream.php:405 #: mailstream.php:420
msgid "URI"
msgstr ""
#: mailstream.php:421
msgid "Local" msgid "Local"
msgstr "" msgstr ""
#: mailstream.php:481 #: mailstream.php:499
msgid "Enabled" msgid "Enabled"
msgstr "" msgstr ""
#: mailstream.php:486 #: mailstream.php:504
msgid "Email Address" msgid "Email Address"
msgstr "" msgstr ""
#: mailstream.php:488 #: mailstream.php:506
msgid "Leave blank to use your account email address" msgid "Leave blank to use your account email address"
msgstr "" msgstr ""
#: mailstream.php:492 #: mailstream.php:510
msgid "Exclude Likes" msgid "Exclude Likes"
msgstr "" msgstr ""
#: mailstream.php:494 #: mailstream.php:512
msgid "Check this to omit mailing \"Like\" notifications" msgid "Check this to omit mailing \"Like\" notifications"
msgstr "" msgstr ""
#: mailstream.php:498 #: mailstream.php:516
msgid "Attach Images" msgid "Attach Images"
msgstr "" msgstr ""
#: mailstream.php:500 #: mailstream.php:518
msgid "" msgid ""
"Download images in posts and attach them to the email. Useful for reading " "Download images in posts and attach them to the email. Useful for reading "
"email while offline." "email while offline."
msgstr "" msgstr ""
#: mailstream.php:507 #: mailstream.php:525
msgid "Mail Stream Settings" msgid "Mail Stream Settings"
msgstr "" msgstr ""

View File

@ -4,96 +4,77 @@
# #
# #
# Translators: # Translators:
# Aditoo, 2018 # Michal Šupler <msupler@gmail.com>, 2014
# michal_s <msupler@gmail.com>, 2014
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: friendica\n" "Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-21 19:15-0500\n" "POT-Creation-Date: 2014-06-23 14:45+0200\n"
"PO-Revision-Date: 2014-06-23 09:54+0000\n" "PO-Revision-Date: 2014-07-07 19:19+0000\n"
"Last-Translator: Aditoo, 2018\n" "Last-Translator: Michal Šupler <msupler@gmail.com>\n"
"Language-Team: Czech (http://app.transifex.com/Friendica/friendica/language/cs/)\n" "Language-Team: Czech (http://www.transifex.com/projects/p/friendica/language/cs/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Language: cs\n" "Language: cs\n"
"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
#: mailstream.php:77 #: mailstream.php:55
msgid "From Address" msgid "From Address"
msgstr "Adresa odesílatele" msgstr "Adresa odesílatele"
#: mailstream.php:79 #: mailstream.php:57
msgid "Email address that stream items will appear to be from." msgid "Email address that stream items will appear to be from."
msgstr "Adresa, která vysílá položky, se objeví jako odesílatel." msgstr "Adresa, která vysílá položky, se objeví jako odesílatel."
#: mailstream.php:82 #: mailstream.php:60 mailstream.php:282
msgid "Save Settings" msgid "Save Settings"
msgstr "Uložit nastavení" msgstr "Uložit Nastavení"
#: mailstream.php:301 #: mailstream.php:165
msgid "Re:" msgid "Re:"
msgstr "Re:" msgstr "Re:"
#: mailstream.php:314 mailstream.php:317 #: mailstream.php:173
msgid "Friendica post" msgid "Friendica post"
msgstr "Příspěvek z Friendica" msgstr "Friendica příspěvky"
#: mailstream.php:320 #: mailstream.php:176
msgid "Diaspora post" msgid "Diaspora post"
msgstr "Příspěvek z Diaspora" msgstr "Diaspora příspvěvky"
#: mailstream.php:330 #: mailstream.php:183
msgid "Feed item" msgid "Feed item"
msgstr "Položka kanálu" msgstr "Zdrojová položka"
#: mailstream.php:333 #: mailstream.php:186
msgid "Email" msgid "Email"
msgstr "E-mail" msgstr "E-mail"
#: mailstream.php:335 #: mailstream.php:188
msgid "Friendica Item" msgid "Friendica Item"
msgstr "Položka z Friendica" msgstr "Friendica položka"
#: mailstream.php:404 #: mailstream.php:229
msgid "Upstream" msgid "Upstream"
msgstr "Upstream" msgstr "Upstream"
#: mailstream.php:405 #: mailstream.php:230
msgid "Local" msgid "Local"
msgstr "Místní" msgstr "Lokální"
#: mailstream.php:481 #: mailstream.php:274
msgid "Enabled"
msgstr "Povoleno"
#: mailstream.php:486
msgid "Email Address" msgid "Email Address"
msgstr "E-mailová adresa" msgstr "E-mailová adresa"
#: mailstream.php:488 #: mailstream.php:276
msgid "Leave blank to use your account email address" msgid "Leave blank to use your account email address"
msgstr "Ponechte prázdné pro použití vaší e-mailové adresy" msgstr "Ponechte prázdné pro použití vaší e-mailové adresy"
#: mailstream.php:492 #: mailstream.php:279
msgid "Exclude Likes" msgid "Enabled"
msgstr "Vynechávat \"lajky\"" msgstr "Povoleno"
#: mailstream.php:494 #: mailstream.php:281
msgid "Check this to omit mailing \"Like\" notifications"
msgstr "Zaškrtnutím vypnete posílání oznámení o \"To se mi líbí\""
#: mailstream.php:498
msgid "Attach Images"
msgstr "Připojit obrázky"
#: mailstream.php:500
msgid ""
"Download images in posts and attach them to the email. Useful for reading "
"email while offline."
msgstr "Stahovat obrázky v příspěvcích a připojovat je k e-mailu. Užitečné pro čtení e-mailu, když jste offline."
#: mailstream.php:507
msgid "Mail Stream Settings" msgid "Mail Stream Settings"
msgstr "Nastavení Mail Stream" msgstr "Mail Stream nastavení"

View File

@ -3,24 +3,20 @@
if(! function_exists("string_plural_select_cs")) { if(! function_exists("string_plural_select_cs")) {
function string_plural_select_cs($n){ function string_plural_select_cs($n){
$n = intval($n); $n = intval($n);
if (($n == 1 && $n % 1 == 0)) { return 0; } else if (($n >= 2 && $n <= 4 && $n % 1 == 0)) { return 1; } else if (($n % 1 != 0 )) { return 2; } else { return 3; } if (($n==1)) { return 0; } else if (($n>=2 && $n<=4)) { return 1; } else { return 2; }
}} }}
$a->strings['From Address'] = 'Adresa odesílatele'; $a->strings['From Address'] = 'Adresa odesílatele';
$a->strings['Email address that stream items will appear to be from.'] = 'Adresa, která vysílá položky, se objeví jako odesílatel.'; $a->strings['Email address that stream items will appear to be from.'] = 'Adresa, která vysílá položky, se objeví jako odesílatel.';
$a->strings['Save Settings'] = 'Uložit nastavení'; $a->strings['Save Settings'] = 'Uložit Nastavení';
$a->strings['Re:'] = 'Re:'; $a->strings['Re:'] = 'Re:';
$a->strings['Friendica post'] = 'Příspěvek z Friendica'; $a->strings['Friendica post'] = 'Friendica příspěvky';
$a->strings['Diaspora post'] = 'Příspěvek z Diaspora'; $a->strings['Diaspora post'] = 'Diaspora příspvěvky';
$a->strings['Feed item'] = 'Položka kanálu'; $a->strings['Feed item'] = 'Zdrojová položka';
$a->strings['Email'] = 'E-mail'; $a->strings['Email'] = 'E-mail';
$a->strings['Friendica Item'] = 'Položka z Friendica'; $a->strings['Friendica Item'] = 'Friendica položka';
$a->strings['Upstream'] = 'Upstream'; $a->strings['Upstream'] = 'Upstream';
$a->strings['Local'] = 'Místní'; $a->strings['Local'] = 'Lokální';
$a->strings['Enabled'] = 'Povoleno';
$a->strings['Email Address'] = 'E-mailová adresa'; $a->strings['Email Address'] = 'E-mailová adresa';
$a->strings['Leave blank to use your account email address'] = 'Ponechte prázdné pro použití vaší e-mailové adresy'; $a->strings['Leave blank to use your account email address'] = 'Ponechte prázdné pro použití vaší e-mailové adresy';
$a->strings['Exclude Likes'] = 'Vynechávat "lajky"'; $a->strings['Enabled'] = 'Povoleno';
$a->strings['Check this to omit mailing "Like" notifications'] = 'Zaškrtnutím vypnete posílání oznámení o "To se mi líbí"'; $a->strings['Mail Stream Settings'] = 'Mail Stream nastavení';
$a->strings['Attach Images'] = 'Připojit obrázky';
$a->strings['Download images in posts and attach them to the email. Useful for reading email while offline.'] = 'Stahovat obrázky v příspěvcích a připojovat je k e-mailu. Užitečné pro čtení e-mailu, když jste offline.';
$a->strings['Mail Stream Settings'] = 'Nastavení Mail Stream';

View File

@ -5,17 +5,16 @@
# #
# Translators: # Translators:
# Andreas H., 2014 # Andreas H., 2014
# foss <oss@disr.it>, 2022
# Tobias Diekershoff <tobias.diekershoff@gmx.net>, 2018 # Tobias Diekershoff <tobias.diekershoff@gmx.net>, 2018
# Ulf Rompe <transifex.com@rompe.org>, 2019 # Ulf Rompe <transifex.com@rompe.org>, 2019
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: friendica\n" "Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-21 19:15-0500\n" "POT-Creation-Date: 2018-03-11 19:13+0100\n"
"PO-Revision-Date: 2014-06-23 09:54+0000\n" "PO-Revision-Date: 2019-02-18 15:05+0000\n"
"Last-Translator: foss <oss@disr.it>, 2022\n" "Last-Translator: Ulf Rompe <transifex.com@rompe.org>\n"
"Language-Team: German (http://app.transifex.com/Friendica/friendica/language/de/)\n" "Language-Team: German (http://www.transifex.com/Friendica/friendica/language/de/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
@ -30,72 +29,72 @@ msgstr "Absender"
msgid "Email address that stream items will appear to be from." msgid "Email address that stream items will appear to be from."
msgstr "E-Mail-Adresse, die in hochgeladenen Artikeln erscheint." msgstr "E-Mail-Adresse, die in hochgeladenen Artikeln erscheint."
#: mailstream.php:82 #: mailstream.php:82 mailstream.php:380
msgid "Save Settings" msgid "Save Settings"
msgstr "Einstellungen speichern" msgstr "Einstellungen speichern"
#: mailstream.php:301 #: mailstream.php:223
msgid "Re:" msgid "Re:"
msgstr "Re:" msgstr "Re:"
#: mailstream.php:314 mailstream.php:317 #: mailstream.php:231
msgid "Friendica post" msgid "Friendica post"
msgstr "Friendica-Veröffentlichung" msgstr "Friendica-Veröffentlichung"
#: mailstream.php:320 #: mailstream.php:234
msgid "Diaspora post" msgid "Diaspora post"
msgstr "Diaspora-Veröffentlichung" msgstr "Diaspora-Veröffentlichung"
#: mailstream.php:330 #: mailstream.php:244
msgid "Feed item" msgid "Feed item"
msgstr "Artikel-Feed" msgstr "Artikel-Feed"
#: mailstream.php:333 #: mailstream.php:247
msgid "Email" msgid "Email"
msgstr "E-Mail" msgstr "E-Mail"
#: mailstream.php:335 #: mailstream.php:249
msgid "Friendica Item" msgid "Friendica Item"
msgstr "Friendica-Artikel" msgstr "Friendica-Artikel"
#: mailstream.php:404 #: mailstream.php:293
msgid "Upstream" msgid "Upstream"
msgstr "Upstream" msgstr "Upstream"
#: mailstream.php:405 #: mailstream.php:294
msgid "Local" msgid "Local"
msgstr "Lokal" msgstr "Lokal"
#: mailstream.php:481 #: mailstream.php:362
msgid "Enabled" msgid "Enabled"
msgstr "Aktiv" msgstr "eingeschaltet"
#: mailstream.php:486 #: mailstream.php:366
msgid "Email Address" msgid "Email Address"
msgstr "E-Mail-Adresse" msgstr "E-Mail-Adresse"
#: mailstream.php:488 #: mailstream.php:368
msgid "Leave blank to use your account email address" msgid "Leave blank to use your account email address"
msgstr "Leer lassen für deine Konto-E-Mail-Addresse" msgstr "Leer lassen für deine Konto-E-Mail-Addresse"
#: mailstream.php:492 #: mailstream.php:371
msgid "Exclude Likes" msgid "Exclude Likes"
msgstr "Likes ignorieren" msgstr "Likes ignorieren"
#: mailstream.php:494 #: mailstream.php:373
msgid "Check this to omit mailing \"Like\" notifications" msgid "Check this to omit mailing \"Like\" notifications"
msgstr "Diese Option verhindert das Versenden von \"Like\"-Benachrichtigungen per E-Mail." msgstr "Diese Option verhindert das Versenden von \"Like\"-Benachrichtigungen per E-Mail."
#: mailstream.php:498 #: mailstream.php:376
msgid "Attach Images" msgid "Attach Images"
msgstr "Bilder anhängen" msgstr "Bilder anhängen"
#: mailstream.php:500 #: mailstream.php:378
msgid "" msgid ""
"Download images in posts and attach them to the email. Useful for reading " "Download images in posts and attach them to the email. Useful for reading "
"email while offline." "email while offline."
msgstr "Sollen Bilder, die im Beitrag eingebettet sind, als Dateianhang in den E-Mails verschickt werden?" msgstr "Sollen Bilder, die im Beitrag eingebettet sind, als Dateianhang in den E-Mails verschickt werden?"
#: mailstream.php:507 #: mailstream.php:379
msgid "Mail Stream Settings" msgid "Mail Stream Settings"
msgstr "Mail-Nachrichten-Einstellungen" msgstr "Mail-Nachrichten-Einstellungen"

View File

@ -16,7 +16,7 @@ $a->strings['Email'] = 'E-Mail';
$a->strings['Friendica Item'] = 'Friendica-Artikel'; $a->strings['Friendica Item'] = 'Friendica-Artikel';
$a->strings['Upstream'] = 'Upstream'; $a->strings['Upstream'] = 'Upstream';
$a->strings['Local'] = 'Lokal'; $a->strings['Local'] = 'Lokal';
$a->strings['Enabled'] = 'Aktiv'; $a->strings['Enabled'] = 'eingeschaltet';
$a->strings['Email Address'] = 'E-Mail-Adresse'; $a->strings['Email Address'] = 'E-Mail-Adresse';
$a->strings['Leave blank to use your account email address'] = 'Leer lassen für deine Konto-E-Mail-Addresse'; $a->strings['Leave blank to use your account email address'] = 'Leer lassen für deine Konto-E-Mail-Addresse';
$a->strings['Exclude Likes'] = 'Likes ignorieren'; $a->strings['Exclude Likes'] = 'Likes ignorieren';

View File

@ -9,90 +9,90 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: friendica\n" "Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-21 19:15-0500\n" "POT-Creation-Date: 2021-02-01 18:15+0100\n"
"PO-Revision-Date: 2014-06-23 09:54+0000\n" "PO-Revision-Date: 2018-03-19 13:12+0000\n"
"Last-Translator: fabrixxm <fabrix.xm@gmail.com>, 2014,2018\n" "Last-Translator: fabrixxm <fabrix.xm@gmail.com>\n"
"Language-Team: Italian (http://app.transifex.com/Friendica/friendica/language/it/)\n" "Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Language: it\n" "Language: it\n"
"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: mailstream.php:77 #: mailstream.php:66
msgid "From Address" msgid "From Address"
msgstr "Indirizzo di invio" msgstr "Indirizzo di invio"
#: mailstream.php:79 #: mailstream.php:68
msgid "Email address that stream items will appear to be from." msgid "Email address that stream items will appear to be from."
msgstr "Indirizzo email da cui i messaggi appariranno inviati" msgstr "Indirizzo email da cui i messaggi appariranno inviati"
#: mailstream.php:82 #: mailstream.php:71 mailstream.php:382
msgid "Save Settings" msgid "Save Settings"
msgstr "Salva Impostazioni" msgstr "Salva Impostazioni"
#: mailstream.php:301 #: mailstream.php:225
msgid "Re:" msgid "Re:"
msgstr "R:" msgstr "R:"
#: mailstream.php:314 mailstream.php:317 #: mailstream.php:233
msgid "Friendica post" msgid "Friendica post"
msgstr "Messaggio Friendica" msgstr "Messaggio Friendica"
#: mailstream.php:320 #: mailstream.php:236
msgid "Diaspora post" msgid "Diaspora post"
msgstr "Messaggio Diaspora" msgstr "Messaggio Diaspora"
#: mailstream.php:330 #: mailstream.php:246
msgid "Feed item" msgid "Feed item"
msgstr "Elemento da feed" msgstr "Elemento da feed"
#: mailstream.php:333 #: mailstream.php:249
msgid "Email" msgid "Email"
msgstr "Email" msgstr "Email"
#: mailstream.php:335 #: mailstream.php:251
msgid "Friendica Item" msgid "Friendica Item"
msgstr "Elemento da Friendica" msgstr "Elemento da Friendica"
#: mailstream.php:404 #: mailstream.php:296
msgid "Upstream" msgid "Upstream"
msgstr "Upstream" msgstr "Upstream"
#: mailstream.php:405 #: mailstream.php:297
msgid "Local" msgid "Local"
msgstr "Locale" msgstr "Locale"
#: mailstream.php:481 #: mailstream.php:364
msgid "Enabled" msgid "Enabled"
msgstr "Abilitato" msgstr "Abilitato"
#: mailstream.php:486 #: mailstream.php:368
msgid "Email Address" msgid "Email Address"
msgstr "Indirizzo Email" msgstr "Indirizzo Email"
#: mailstream.php:488 #: mailstream.php:370
msgid "Leave blank to use your account email address" msgid "Leave blank to use your account email address"
msgstr "Lascia in bianco per usare l'indirizzo email del tuo account" msgstr "Lascia in bianco per usare l'indirizzo email del tuo account"
#: mailstream.php:492 #: mailstream.php:373
msgid "Exclude Likes" msgid "Exclude Likes"
msgstr "Escludi \"Mi Piace\"" msgstr "Escludi \"Mi Piace\""
#: mailstream.php:494 #: mailstream.php:375
msgid "Check this to omit mailing \"Like\" notifications" msgid "Check this to omit mailing \"Like\" notifications"
msgstr "Seleziona per evitare di inviare notifiche per \"Mi Piace\"" msgstr "Seleziona per evitare di inviare notifiche per \"Mi Piace\""
#: mailstream.php:498 #: mailstream.php:378
msgid "Attach Images" msgid "Attach Images"
msgstr "Allega Immagini" msgstr "Allega Immagini"
#: mailstream.php:500 #: mailstream.php:380
msgid "" msgid ""
"Download images in posts and attach them to the email. Useful for reading " "Download images in posts and attach them to the email. Useful for reading "
"email while offline." "email while offline."
msgstr "Scarica le immagini nei messaggi e le allega alle email. Utile per leggere le email mentre si è offline." msgstr "Scarica le immagini nei messaggi e le allega alle email. Utile per leggere le email mentre si è offline."
#: mailstream.php:507 #: mailstream.php:381
msgid "Mail Stream Settings" msgid "Mail Stream Settings"
msgstr "Impostazioni Mail Stream" msgstr "Impostazioni Mail Stream"

View File

@ -3,7 +3,7 @@
if(! function_exists("string_plural_select_it")) { if(! function_exists("string_plural_select_it")) {
function string_plural_select_it($n){ function string_plural_select_it($n){
$n = intval($n); $n = intval($n);
if ($n == 1) { return 0; } else if ($n != 0 && $n % 1000000 == 0) { return 1; } else { return 2; } return intval($n != 1);
}} }}
$a->strings['From Address'] = 'Indirizzo di invio'; $a->strings['From Address'] = 'Indirizzo di invio';
$a->strings['Email address that stream items will appear to be from.'] = 'Indirizzo email da cui i messaggi appariranno inviati'; $a->strings['Email address that stream items will appear to be from.'] = 'Indirizzo email da cui i messaggi appariranno inviati';

View File

@ -32,7 +32,6 @@ function mailstream_install()
Hook::register('addon_settings_post', 'addon/mailstream/mailstream.php', 'mailstream_addon_settings_post'); Hook::register('addon_settings_post', 'addon/mailstream/mailstream.php', 'mailstream_addon_settings_post');
Hook::register('post_local_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook'); Hook::register('post_local_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook');
Hook::register('post_remote_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook'); Hook::register('post_remote_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook');
Hook::register('cron', 'addon/mailstream/mailstream.php', 'mailstream_cron');
Hook::register('mailstream_send_hook', 'addon/mailstream/mailstream.php', 'mailstream_send_hook'); Hook::register('mailstream_send_hook', 'addon/mailstream/mailstream.php', 'mailstream_send_hook');
Logger::info("mailstream: installed"); Logger::info("mailstream: installed");
@ -67,9 +66,10 @@ function mailstream_module() {}
/** /**
* Adds an item in "addon features" in the admin menu of the site * Adds an item in "addon features" in the admin menu of the site
* *
* @param App $a App object (unused)
* @param string $o HTML form data * @param string $o HTML form data
*/ */
function mailstream_addon_admin(string &$o) function mailstream_addon_admin(App $a, string &$o)
{ {
$frommail = DI::config()->get('mailstream', 'frommail'); $frommail = DI::config()->get('mailstream', 'frommail');
$template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/'); $template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/');
@ -103,14 +103,14 @@ function mailstream_addon_admin_post()
*/ */
function mailstream_generate_id(string $uri): string function mailstream_generate_id(string $uri): string
{ {
$host = DI::baseUrl()->getHost(); $host = DI::baseUrl()->getHostname();
$resource = hash('md5', $uri); $resource = hash('md5', $uri);
$message_id = "<" . $resource . "@" . $host . ">"; $message_id = "<" . $resource . "@" . $host . ">";
Logger::debug('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri); Logger::debug('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri);
return $message_id; return $message_id;
} }
function mailstream_send_hook(array $data) function mailstream_send_hook(App $a, array $data)
{ {
$criteria = array('uid' => $data['uid'], 'contact-id' => $data['contact-id'], 'uri' => $data['uri']); $criteria = array('uid' => $data['uid'], 'contact-id' => $data['contact-id'], 'uri' => $data['uri']);
$item = Post::selectFirst([], $criteria); $item = Post::selectFirst([], $criteria);
@ -138,15 +138,16 @@ function mailstream_send_hook(array $data)
* mailstream is enabled and the necessary data is available, forks a * mailstream is enabled and the necessary data is available, forks a
* workerqueue item to send the email. * workerqueue item to send the email.
* *
* @param App $a App object (unused)
* @param array $item content of the item (may or may not already be stored in the item table) * @param array $item content of the item (may or may not already be stored in the item table)
* @return void * @return void
*/ */
function mailstream_post_hook(array &$item) function mailstream_post_hook(App $a, array &$item)
{ {
mailstream_check_version(); mailstream_check_version();
if (!DI::pConfig()->get($item['uid'], 'mailstream', 'enabled')) { if (!DI::pConfig()->get($item['uid'], 'mailstream', 'enabled')) {
Logger::debug('mailstream: not enabled for item ' . $item['id']); Logger::debug('mailstream: not enabled.', ['item' => $item['id'], ' uid ' => $item['uid']]);
return; return;
} }
if (!$item['uid']) { if (!$item['uid']) {
@ -161,8 +162,8 @@ function mailstream_post_hook(array &$item)
Logger::debug('mailstream: no uri for item ' . $item['id']); Logger::debug('mailstream: no uri for item ' . $item['id']);
return; return;
} }
if (!$item['plink']) { if ($item['verb'] == Activity::ANNOUNCE) {
Logger::debug('mailstream: no plink for item ' . $item['id']); Logger::debug('mailstream: announce item ', ['item' => $item['id']]);
return; return;
} }
if (DI::pConfig()->get($item['uid'], 'mailstream', 'nolikes')) { if (DI::pConfig()->get($item['uid'], 'mailstream', 'nolikes')) {
@ -395,7 +396,9 @@ function mailstream_send(string $message_id, array $item, array $user): bool
$mail->addCustomHeader('In-Reply-To: ' . mailstream_generate_id($item['thr-parent'])); $mail->addCustomHeader('In-Reply-To: ' . mailstream_generate_id($item['thr-parent']));
} }
$mail->addCustomHeader('X-Friendica-Mailstream-URI: ' . $item['uri']); $mail->addCustomHeader('X-Friendica-Mailstream-URI: ' . $item['uri']);
$mail->addCustomHeader('X-Friendica-Mailstream-Plink: ' . $item['plink']); if ($item['plink']) {
$mail->addCustomHeader('X-Friendica-Mailstream-Plink: ' . $item['plink']);
}
$encoding = 'base64'; $encoding = 'base64';
foreach ($attachments as $url => $image) { foreach ($attachments as $url => $image) {
$mail->AddStringEmbeddedImage( $mail->AddStringEmbeddedImage(
@ -411,12 +414,13 @@ function mailstream_send(string $message_id, array $item, array $user): bool
$template = Renderer::getMarkupTemplate('mail.tpl', 'addon/mailstream/'); $template = Renderer::getMarkupTemplate('mail.tpl', 'addon/mailstream/');
$mail->AltBody = BBCode::toPlaintext($item['body']); $mail->AltBody = BBCode::toPlaintext($item['body']);
$item['body'] = BBCode::convertForUriId($item['uri-id'], $item['body'], BBCode::CONNECTORS); $item['body'] = BBCode::convertForUriId($item['uri-id'], $item['body'], BBCode::CONNECTORS);
$item['url'] = DI::baseUrl() . '/display/' . $item['guid']; $item['url'] = DI::baseUrl()->get() . '/display/' . $item['guid'];
$mail->Body = Renderer::replaceMacros($template, [ $mail->Body = Renderer::replaceMacros($template, [
'$upstream' => DI::l10n()->t('Upstream'), '$upstream' => DI::l10n()->t('Upstream'),
'$uri' => DI::l10n()->t('URI'),
'$local' => DI::l10n()->t('Local'), '$local' => DI::l10n()->t('Local'),
'$item' => $item]); '$item' => $item]);
mailstream_html_wrap($mail->Body); $mail->Body = mailstream_html_wrap($mail->Body);
if (!$mail->Send()) { if (!$mail->Send()) {
throw new Exception($mail->ErrorInfo); throw new Exception($mail->ErrorInfo);
} }
@ -437,7 +441,8 @@ function mailstream_send(string $message_id, array $item, array $user): bool
* bbcode's output suitable for transmission, we try to break things * bbcode's output suitable for transmission, we try to break things
* up so that lines are about 200 characters. * up so that lines are about 200 characters.
* *
* @param string $text text to word wrap - modified in-place * @param string $text text to word wrap
* @return string wrapped text
*/ */
function mailstream_html_wrap(string &$text) function mailstream_html_wrap(string &$text)
{ {
@ -446,6 +451,7 @@ function mailstream_html_wrap(string &$text)
$lines[$i] = preg_replace('/ /', "\n", $lines[$i], 1); $lines[$i] = preg_replace('/ /', "\n", $lines[$i], 1);
} }
$text = implode($lines); $text = implode($lines);
return $text;
} }
/** /**
@ -462,8 +468,7 @@ function mailstream_convert_table_entries()
'message_id' => $ms_item_id['message-id'], 'message_id' => $ms_item_id['message-id'],
'tries' => 0); 'tries' => 0);
if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) { if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) {
Logger::info('mailstream_cron: Item ' . Logger::info('mailstream_convert_table_entries: item has no message-id.', 'item' => $ms_item_id['id'], 'uri' => $ms_item_id['uri']]);
$ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id');
continue; continue;
} }
Logger::info('mailstream_convert_table_entries: convert item to workerqueue', $send_hook_data); Logger::info('mailstream_convert_table_entries: convert item to workerqueue', $send_hook_data);
@ -475,10 +480,11 @@ function mailstream_convert_table_entries()
/** /**
* Form for configuring mailstream features for a user * Form for configuring mailstream features for a user
* *
* @param App $a App object
* @param array $data Hook data array * @param array $data Hook data array
* @throws \Friendica\Network\HTTPException\ServiceUnavailableException * @throws \Friendica\Network\HTTPException\ServiceUnavailableException
*/ */
function mailstream_addon_settings(array &$data) function mailstream_addon_settings(App &$a, array &$data)
{ {
$enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'enabled'); $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'enabled');
$address = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'address'); $address = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'address');
@ -522,10 +528,11 @@ function mailstream_addon_settings(array &$data)
/** /**
* Process data submitted to user's mailstream features form * Process data submitted to user's mailstream features form
* @param App $a
* @param array $post POST data * @param array $post POST data
* @return void * @return void
*/ */
function mailstream_addon_settings_post(array $post) function mailstream_addon_settings_post(App $a, array $post)
{ {
if (!DI::userSession()->getLocalUserId() || empty($post['mailstream-submit'])) { if (!DI::userSession()->getLocalUserId() || empty($post['mailstream-submit'])) {
return; return;

View File

@ -6,5 +6,6 @@
<div class="mailstream-item-body">{{$item.body nofilter}}</div> <div class="mailstream-item-body">{{$item.body nofilter}}</div>
{{if $item.plink}} {{if $item.plink}}
<div>{{$upstream}}: <a class="mailstream-item-plink" href="{{$item.plink}}">{{$item.plink}}</a><div> <div>{{$upstream}}: <a class="mailstream-item-plink" href="{{$item.plink}}">{{$item.plink}}</a><div>
<div>{{$uri}}: <a class="mailstream-item-uri" href="{{$item.uri}}">{{$item.uri}}</a><div>
<div>{{$local}}: <a class="mailstream-item-url" href="{{$item.url}}">{{$item.url}}</a></div> <div>{{$local}}: <a class="mailstream-item-url" href="{{$item.url}}">{{$item.url}}</a></div>
{{/if}} {{/if}}