X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fjabber.php;h=a0f5080d0fb9faeb641010704a3949eee606d02f;hb=e59cfea9bc75a551dab0bc19fcab9a6a9e119b4e;hp=b0dc24bd0dfdab0a5f775dbcdfd2d7dc5ac0cba1;hpb=499afd8c22fa7b14c5d757f52b1e8e6a91bbaf30;p=quix0rs-gnu-social.git
diff --git a/lib/jabber.php b/lib/jabber.php
index b0dc24bd0d..a0f5080d0f 100644
--- a/lib/jabber.php
+++ b/lib/jabber.php
@@ -37,8 +37,11 @@ class Laconica_XMPP extends XMPPHP_XMPP {
$out .= "
$body";
if($payload) $out .= $payload;
$out .= "";
-
+
+ $cnt = strlen($out);
+ common_log(LOG_DEBUG, "Sending $cnt chars to $to");
$this->send($out);
+ common_log(LOG_DEBUG, 'Done.');
}
}
@@ -114,6 +117,7 @@ function jabber_send_notice($to, $notice) {
# Extra stuff defined by Twitter, needed by twitter clients
function jabber_format_entry($profile, $notice) {
+
$noticeurl = common_local_url('shownotice',
array('notice' => $notice->id));
$msg = jabber_format_notice($profile, $notice);
@@ -132,6 +136,13 @@ function jabber_format_entry($profile, $notice) {
$entry .= "".common_date_w3dtf($notice->created)."\n";
$entry .= "".common_date_w3dtf($notice->modified)."\n";
$entry .= "\n";
+
+ $html = "\n\n";
+ $html .= "\n";
+ $html .= "".$profile->nickname.": ";
+ $html .= ($notice->rendered) ? $notice->rendered : common_render_content($notice->content, $notice);
+ $html .= "\n\n";
+ $html .= "\n\n";
$event = "\n";
$event .= "id] = true;
} else {
# XXX: Not sure, but I think that's the right thing to do
+ common_log(LOG_WARNING,
+ 'Sending reply notice ' . $notice->id . ' to ' . $user->jabber . ' FAILED, cancelling.',
+ __FILE__);
return false;
}
}
@@ -238,13 +252,32 @@ function jabber_broadcast_notice($notice) {
$success = jabber_send_notice($user->jabber, $notice);
if ($success) {
$sent_to[$user->id] = true;
+ } else {
# XXX: Not sure, but I think that's the right thing to do
+ common_log(LOG_WARNING,
+ 'Sending notice ' . $notice->id . ' to ' . $user->jabber . ' FAILED, cancelling.',
+ __FILE__);
return false;
}
}
}
}
+ # Now, users who want everything
+
+ $public = common_config('xmpp', 'public');
+
+ # FIXME PRIV don't send out private messages here
+
+ if ($public) {
+ foreach ($public as $address) {
+ common_log(LOG_INFO,
+ 'Sending notice ' . $notice->id . ' to public listener ' . $address,
+ __FILE__);
+ jabber_send_notice($address, $notice);
+ }
+ }
+
return true;
}