X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FXmpp%2FXmppPlugin.php;h=da205043298ab081f788a1f984ae3bef15da4bae;hb=0df853183485add783c59e9fac3a58258918817b;hp=2974e8b2ab40e29ed30f0371652f2751868a65c1;hpb=dfd83bd89876c917129ab6e27c800aa34c93f538;p=quix0rs-gnu-social.git diff --git a/plugins/Xmpp/XmppPlugin.php b/plugins/Xmpp/XmppPlugin.php index 2974e8b2ab..da20504329 100644 --- a/plugins/Xmpp/XmppPlugin.php +++ b/plugins/Xmpp/XmppPlugin.php @@ -308,11 +308,6 @@ class XmppPlugin extends ImPlugin return true; } - function microiduri($screenname) - { - return 'xmpp:' . $screenname; - } - function sendMessage($screenname, $body) { $this->queuedConnection()->message($screenname, $body, 'chat'); @@ -320,9 +315,13 @@ class XmppPlugin extends ImPlugin function sendNotice($screenname, Notice $notice) { - $msg = $this->formatNotice($notice); - $entry = $this->format_entry($notice); - + try { + $msg = $this->formatNotice($notice); + $entry = $this->format_entry($notice); + } catch (Exception $e) { + common_log(LOG_ERR, __METHOD__ . ": Discarding outgoing stanza because of exception: {$e->getMessage()}"); + return false; // return value of sendNotice is never actually used as of now + } $this->queuedConnection()->message($screenname, $msg, 'chat', null, $entry); return true; } @@ -354,15 +353,14 @@ class XmppPlugin extends ImPlugin $xs->text(": "); } catch (InvalidUrlException $e) { $xs->text(sprintf(' => %s', $orig_profile->nickname)); - } catch (Exception $e) { + } catch (NoParentNoticeException $e) { + $xs->text(": "); + } catch (NoResultException $e) { + // Parent notice was probably deleted. $xs->text(": "); } - if (!empty($notice->rendered)) { - $notice->rendered = str_replace("\t", "", $notice->rendered); - $xs->raw($notice->rendered); - } else { - $xs->raw(common_render_content($notice->content, $notice)); - } + // FIXME: Why do we replace \t with ''? is it just to make it pretty? shouldn't whitespace be handled well...? + $xs->raw(str_replace("\t", "", $notice->getRendered())); $xs->text(" "); $xs->element('a', array( 'href'=>common_local_url('conversation', @@ -462,12 +460,12 @@ class XmppPlugin extends ImPlugin } - function onPluginVersion(&$versions) + function onPluginVersion(array &$versions) { $versions[] = array('name' => 'XMPP', 'version' => GNUSOCIAL_VERSION, 'author' => 'Craig Andrews, Evan Prodromou', - 'homepage' => 'http://status.net/wiki/Plugin:XMPP', + 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/XMPP', 'rawdescription' => // TRANS: Plugin description. _m('The XMPP plugin allows users to send and receive notices over the XMPP/Jabber network.'));