[add extra Twitter cruft to jabber messages Evan Prodromou **20080714034503] { hunk ./lib/jabber.php 69 + +function jabber_send_notice($to, $notice) { + $conn = jabber_connect(); + if (!$conn) { + return false; + } + $profile = Profile::staticGet($notice->profile_id); + if (!$profile) { + common_log(LOG_WARNING, 'Refusing to send notice with ' . + 'unknown profile ' . common_log_objstring($notice), + __FILE__); + return false; + } + $msg = jabber_format_notice($profile, $notice); + $entry = jabber_format_entry($profile, $notice); + $conn->message($to, $msg, 'chat', $entry); + return true; +} + +# Extra stuff defined by Twitter, needed by twitter clients + +function jabber_format_entry($profile, $notice) { + $noticeurl = common_local_url('shownotice', + array('notice' => $notice->id)); + $entry = "\n"; + $entry .= "\n"; + $entry .= "" . $profile->nickname . " - " . common_config('site', 'name') . "\n"; + $entry .= "\n"; + $entry .= " $profile->nickname)) . "'/>\n"; + $entry .= "" . $profile->nickname . "\n"; + $entry .= "" . common_profile_avatar_url($profile, AVATAR_STREAM_SIZE) . "\n"; + $entry .= "\n"; + $entry .= "" . $msg . "\n"; + $entry .= "" . $msg . "\n"; + $entry .= "\n"; + $entry .= "". $notice->uri . "\n"; + $entry .= "".common_date_w3dtf($notice->created)."\n"; + $entry .= "".common_date_w3dtf($notice->modified)."\n"; + $entry .= "\n"; + $entry .= "\n"; + $entry .= "\n"; + $entry .= "\n"; + $entry .= "\n"; + $entry .= "\n"; + return $entry; +} }