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
--------------
* Author: Michael Vogel <http://pirati.ca/profile/heluecht>
*
*/
-//use DOMDocument;
-//use DOMXPath;
use Friendica\App;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
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()) {
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;