diff --git a/discourse/README b/discourse/README index 65c54d20..338b10bf 100644 --- a/discourse/README +++ b/discourse/README @@ -16,7 +16,7 @@ The mailing list mode in Discourse knows two different options: 2. Don't get your own posts. Then you will missing all your posts that you made directly on Discourse. Since you cannot create a new post via this connector (only comments are possible) - this is not a goog choice either. + this is not a good choice either. Known problems -------------- diff --git a/discourse/discourse.php b/discourse/discourse.php index 15081cd1..2fce970d 100644 --- a/discourse/discourse.php +++ b/discourse/discourse.php @@ -7,8 +7,6 @@ * Author: Michael Vogel * */ -//use DOMDocument; -//use DOMXPath; use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\L10n; @@ -40,13 +38,6 @@ function discourse_install() Hook::register('connector_settings_post', __FILE__, 'discourse_settings_post'); } -function discourse_uninstall() -{ - Hook::unregister('email_getmessage', __FILE__, 'discourse_email_getmessage'); - Hook::unregister('connector_settings', __FILE__, 'discourse_settings'); - Hook::unregister('connector_settings_post', __FILE__, 'discourse_settings_post'); -} - function discourse_settings(App $a, &$s) { if (!local_user()) { @@ -249,6 +240,12 @@ function discourse_process_post($message, $post, $hostaddr) if ($post['post_number'] == 1) { $message['item']['parent-uri'] = $message['item']['uri'] = 'topic/' . $post['topic_id'] . '@' . $host; + + // Remove the Discourse forum name from the subject + $pattern = '=\[.*\].*\s(\[.*\].*)='; + if (preg_match($pattern, $message['item']['title'])) { + $message['item']['title'] = preg_replace($pattern, '$1', $message['item']['title']); + } /// @ToDo Fetch thread information } else { $message['item']['uri'] = 'topic/' . $post['topic_id'] . '/' . $post['id'] . '@' . $host;