From: Evan Prodromou Date: Tue, 15 Jul 2008 03:37:11 +0000 (-0400) Subject: build stanza ourselves, without library X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7ad21d3cc1e4761e385a24df73ac4943242ce4f0;p=quix0rs-gnu-social.git build stanza ourselves, without library darcs-hash:20080715033711-84dde-f4a4583d8182dc18fec6f7ea7e2e27ff4958cb90.gz --- diff --git a/lib/jabber.php b/lib/jabber.php index 74e51d71a7..79325eb192 100644 --- a/lib/jabber.php +++ b/lib/jabber.php @@ -86,11 +86,28 @@ function jabber_send_notice($to, $notice) { } $msg = jabber_format_notice($profile, $notice); $entry = jabber_format_entry($profile, $notice); - common_log(LOG_DEBUG, 'special entry = ' . $entry, __FILE__); - $conn->message($to, $msg, 'chat', NULL, $entry); + $stanza = jabber_make_stanza($to, $msg, 'chat', NULL, $entry); + common_log(LOG_DEBUG, 'full stanza = ' . $stanza, __FILE__); + $conn->send($stanza); return true; } +function jabber_make_stanza($to, $body, $type = 'chat', $subject = null, $payload = null) { + $to = htmlspecialchars($to); + $body = htmlspecialchars($body); + $subject = htmlspecialchars($subject); + + $jid = jabber_daemon_address(); + + $out = ""; + if($subject) $out .= "$subject"; + $out .= "$body"; + if($payload) $out .= $payload; + $out .= ""; + + return $out; +} + # Extra stuff defined by Twitter, needed by twitter clients function jabber_format_entry($profile, $notice) {