From a7984e660da4def80d28a4efeacb5ee861c4718c Mon Sep 17 00:00:00 2001
From: Meik Sievertsen <acydburn@phpbb.com>
Date: Sat, 5 Jan 2008 16:10:10 +0000
Subject: Correctly check empty subjects/messages (Bug #17915) Do not check
 usernames against word censor list. Disallowed usernames is already checked
 and word censor belong to posts. (Bug #17745) Additionally include
 non-postable forums for moderators forums shown within the teams list. (Bug
 #17265)

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8306 89ea8834-ac86-4346-8a33-228a782c2dd0
---
 phpBB/includes/functions_jabber.php | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

(limited to 'phpBB/includes/functions_jabber.php')

diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php
index 8575f339c1..7633c10be9 100644
--- a/phpBB/includes/functions_jabber.php
+++ b/phpBB/includes/functions_jabber.php
@@ -20,11 +20,11 @@ if (!defined('IN_PHPBB'))
 *
 * Jabber class from Flyspray project
 *
-* @version class.jabber2.php 1306 2007-06-21
+* @version class.jabber2.php 1488 2007-11-25
 * @copyright 2006 Flyspray.org
 * @author Florian Schmitz (floele)
 *
-* Modified by Acyd Burn
+* Only slightly modified by Acyd Burn
 *
 * @package phpBB3
 */
@@ -286,7 +286,7 @@ class jabber
 			$read = trim(fread($this->connection, 4096));
 			$data .= $read;
 		}
-		while (time() <= $start + $timeout && ($wait || $data == '' || $read != '' || (substr(rtrim($data), -1) != '>')));
+		while (time() <= $start + $timeout && !feof($this->connection) && ($wait || $data == '' || $read != '' || (substr(rtrim($data), -1) != '>')));
 
 		if ($data != '')
 		{
@@ -385,7 +385,6 @@ class jabber
 		{
 			case 'stream:stream':
 				// Connection initialised (or after authentication). Not much to do here...
-				$this->session['id'] = $xml['stream:stream'][0]['@']['id'];
 
 				if (isset($xml['stream:stream'][0]['#']['stream:features']))
 				{
@@ -397,6 +396,16 @@ class jabber
 					$this->features = $this->listen();
 				}
 
+				$second_time = isset($this->session['id']);
+				$this->session['id'] = $xml['stream:stream'][0]['@']['id'];
+
+				if ($second_time)
+				{
+					// If we are here for the second time after TLS, we need to continue logging in
+					$this->login();
+					return;
+				}
+
 				// go on with authentication?
 				if (isset($this->features['stream:features'][0]['#']['bind']) || !empty($this->session['tls']))
 				{
@@ -519,9 +528,10 @@ class jabber
 						'response'	=> $this->encrypt_password(array_merge($decoded, array('nc' => '00000001'))),
 						'charset'	=> 'utf-8',
 						'nc'		=> '00000001',
+						'qop'		=> 'auth',			// only auth being supported
 					);
 
-					foreach (array('nonce', 'qop', 'digest-uri', 'realm', 'cnonce') as $key)
+					foreach (array('nonce', 'digest-uri', 'realm', 'cnonce') as $key)
 					{
 						if (isset($decoded[$key]))
 						{
-- 
cgit v1.2.1