disco#info to the server

Edward Rudd erudd at netfor.com
Wed Jul 25 16:08:36 UTC 2007


SWEEET!!!!!

I've been trying to figure out what was different between djabberd and
jabberd14 in terms of service discovery. since psi would correctly
detect the MUC service but Pidgin would not.   And the "from" was
Exactly it.

I just applied this to my copy and verified it fixes that issue. Thanks
Piers!.

Here is an SVN diff from Trunk.


Index: DJabberd/IQ.pm
===================================================================
--- DJabberd/IQ.pm	(revision 758)
+++ DJabberd/IQ.pm	(working copy)
@@ -102,8 +102,10 @@
     $raw ||= "";
     my $id = $self->id;
     my $bj = $conn->bound_jid;
+    my $from_jid = $self->to;
     my $to = $bj ? ("to='" . $bj->as_string_exml . "'") : "";
-    my $xml = qq{<iq $to type='$type' id='$id'>$raw</iq>};
+    my $from = $from_jid ? ("from='".$from_jid."'") : "";
+    my $xml = qq{<iq $to $from type='$type' id='$id'>$raw</iq>};
     $conn->xmllog->info($xml);
     $conn->write(\$xml);
 }


Piers Harding wrote:
> Hi -
> 
> I was wondering if others had seen a problem with some clients when
> doing service discovery.
> 
> I have noticed that when an iq eg:
> <iq type='get' id='99' from='piers at gecko.local.net/Gajim'
> to='gecko.local.net'><query xmlns='http://jabber.org/protocol/disco#info'/></iq>
> 
> is sent from Gajim or Psi and a result comes back:
> <iq to='piers at gecko.local.net/Gajim' type='result' id='99'>
> <query xmlns='http://jabber.org/protocol/disco#info'>
> <identity category='server' type='im' name='djabberd'/>
> <feature var='http://jabber.org/protocol/disco#info'/>
> <feature var='urn:xmpp:ping'/>
> <feature var='vcard-temp'/>
> <feature var='jabber:iq:version'/>
> </query>
> </iq>
> 
> The client does not process the return.  If I do the same test with
> jabber.org which is running ejabberd, I can see that the result is
> stamped with a from jid - eg:
> <iq id="30" type="result"  to='piers at ompka.net/Gajim' from='jabber.org'>
> <query xmlns='http://jabber.org/protocol/disco#items'>
> ....
> 
> 
> If I modify DJabberd::IQ ->
> sub send_reply {
>     my DJabberd::IQ $self = shift;
>     my ($type, $raw) = @_;
> 
>     my $conn = $self->{connection}
>         or return;
> 
>     $raw ||= "";
>     my $id = $self->id;
>     my $bj = $conn->bound_jid;
>     my $from_jid = $self->to;
>     my $to = $bj ? ("to='" .  $bj->as_string_exml . "'") : "";
>     my $from = $from_jid ?  ("from='" . $from_jid . "'") : "";
>     my $xml = qq{<iq $to $from type='$type' id='$id'>$raw</iq>};
>     $conn->xmllog->info($xml);
>     $conn->write(\$xml);
> }
> 
> So that it is stamped with a from address, then djabberd exhibits the
> same behaviour.
> 
> Is this correct or is it a case of the client being broken?
> 
> Thanks,
> Piers Harding.
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: erudd.vcf
Type: text/x-vcard
Size: 272 bytes
Desc: not available
Url : http://lists.danga.com/pipermail/djabberd/attachments/20070725/4851812b/erudd.vcf


More information about the Djabberd mailing list