diff --git a/lib/common.php b/lib/common.php index 9d321f27d4..d8ef18d907 100644 --- a/lib/common.php +++ b/lib/common.php @@ -70,7 +70,8 @@ $config = 'user' => 'update', 'resource' => 'uniquename', 'password' => 'blahblahblah', - 'host' => NULL), # only set if != server + 'host' => NULL, # only set if != server + 'debug' => false), # print extra debug info ); $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options'); diff --git a/lib/jabber.php b/lib/jabber.php index 35ae07fece..d109e40c46 100644 --- a/lib/jabber.php +++ b/lib/jabber.php @@ -45,14 +45,19 @@ function jabber_connect($resource=NULL) { static $conn = NULL; if (!$conn) { $conn = new XMPPHP_XMPP(common_config('xmpp', 'host') ? - common_config('xmpp', 'host') : - common_config('xmpp', 'server'), - common_config('xmpp', 'port'), - common_config('xmpp', 'user'), - common_config('xmpp', 'password'), - ($resource) ? $resource : - common_config('xmpp', 'resource'), - common_config('xmpp', 'server')); + common_config('xmpp', 'host') : + common_config('xmpp', 'server'), + common_config('xmpp', 'port'), + common_config('xmpp', 'user'), + common_config('xmpp', 'password'), + ($resource) ? $resource : + common_config('xmpp', 'resource'), + common_config('xmpp', 'server'), + common_config('xmpp', 'debug') ? + true : false, + common_config('xmpp', 'debug') ? + XMPPHP_Log::LEVEL_VERBOSE : NULL + ); $conn->autoSubscribe(); if (!$conn) { @@ -81,6 +86,7 @@ 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); return true; } @@ -91,13 +97,13 @@ function jabber_format_entry($profile, $notice) { $noticeurl = common_local_url('shownotice', array('notice' => $notice->id)); $msg = jabber_format_notice($profile, $notice); - $entry = "\n"; + $entry = "\n\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 .= "" . common_profile_avatar_url($profile, AVATAR_PROFILE_SIZE) . "\n"; $entry .= "\n"; $entry .= "" . $msg . "\n"; $entry .= "" . $msg . "\n"; @@ -106,13 +112,16 @@ function jabber_format_entry($profile, $notice) { $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"; + + $event = "\n"; + $event .= "\n"; + $event .= "\n"; + $event .= "\n"; + $event .= "\n"; + # FIXME: include the pubsub event, too. return $entry; +# return $entry . "\n" . $event; } function jabber_send_message($to, $body, $type='chat', $subject=NULL) {