summaryrefslogtreecommitdiff
path: root/lib/queued_xmpp.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-08 12:19:06 -0800
committerBrion Vibber <brion@pobox.com>2010-03-08 12:19:06 -0800
commit217ad420ac8085fe620235dfc47bea27e4ac75dc (patch)
tree2f3b6934d95704ed9972de267816309d8ebfed19 /lib/queued_xmpp.php
parenta77efb2447abe75d3b9902410bced61b76377de3 (diff)
Fix ticket #2208: regression in XMPP sending when server != host
The upstream class sets $this->basejid with host unconditionally, which wasn't previously an issue as the fulljid would always be filled in by the server at connect time before sending messages. With the new queued messaging, we need to make sure we've filled out $this->fulljid correctly without making a connection. Now using $server if provided to build $this->basejid and $this->fulljid in the queued XMPP proxy class, so queued messages are sent correctly.
Diffstat (limited to 'lib/queued_xmpp.php')
-rw-r--r--lib/queued_xmpp.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/queued_xmpp.php b/lib/queued_xmpp.php
index fdd074db2..f6bccfd5b 100644
--- a/lib/queued_xmpp.php
+++ b/lib/queued_xmpp.php
@@ -49,10 +49,20 @@ class Queued_XMPP extends XMPPHP_XMPP
*/
public function __construct($host, $port, $user, $password, $resource, $server = null, $printlog = false, $loglevel = null)
{
- parent::__construct($host, $port, $user, $password, $resource, $server, $printlog, $loglevel);
- // Normally the fulljid isn't filled out until resource binding time;
- // we need to save it here since we're not talking to a real server.
- $this->fulljid = "{$this->basejid}/{$this->resource}";
+ parent::__construct($host, $port, $user, $password, $resource, $server, $printlog, $loglevel);
+
+ // We use $host to connect, but $server to build JIDs if specified.
+ // This seems to fix an upstream bug where $host was used to build
+ // $this->basejid, never seen since it isn't actually used in the base
+ // classes.
+ if (!$server) {
+ $server = $this->host;
+ }
+ $this->basejid = $this->user . '@' . $server;
+
+ // Normally the fulljid is filled out by the server at resource binding
+ // time, but we need to do it since we're not talking to a real server.
+ $this->fulljid = "{$this->basejid}/{$this->resource}";
}
/**