Chatroom invitations
Clive Holloway
clive.holloway at gmail.com
Wed Nov 7 21:08:22 UTC 2007
Thanks for the input. On further testing I found that this isn't
sufficient. I wasn't going to repost until I was completely sure, but
anyway.
My revised conditional breaks on actual chat messages. What I'm using now is:
if ($stanza->isa("DJabberd::Message")
&& ref $stanza->{children}[0]
&& $stanza->{children}[0]{element} eq 'x'
&& ! ref $stanza->{children}[1]
&& ref $stanza->{children}[0]{children}[0]
&& $stanza->{children}[0]{children}[0]{element} eq 'invite') {
It works for what I need it for, but I think until I completely
understand the code, I'll refrain from offering patches or anything
like that :)
cLive ;-)
On Nov 7, 2007 1:35 PM, Peter Saint-Andre <stpeter at stpeter.im> wrote:
> Martin Atkins wrote:
> > Clive Holloway wrote:
> >>
> >> This snippet allows chatroom members to send invites to other users.
> >>
> > [snip]
> >>
> >> if ($stanza->isa("DJabberd::Message")
> >> && $stanza->{children}[0]{element} eq 'x'
> >> && $stanza->{children}[0]{children}[0]{element} eq
> >> 'invite') {
> >>
> >
> > This seems risky, since I believe <message> stanzas can come with a
> > <body> in them for fallback in clients without MUC support, like this:
> >
> > <message ...>
> > <subject>Conference Invitation</subject>
> > <body>Please join me in the conference room "blah"
> > on conference.example.com.</body>
> > <x xmlns="jabber:x:conference">
> > <invite ... />
> > </x>
> > </message>
> >
> > Probably should also verify the namespace of that "x" element, too. The
> > MUC spec seems to suggest that it should be:
> > <http://jabber.org/protocol/muc#user>
>
> Correct. The jabber:x:conference was an old namespace we used back in
> 2000/2001 and it has been deprecated for some time now.
>
> Peter
>
> --
> Peter Saint-Andre
> https://stpeter.im/
>
>
More information about the Djabberd
mailing list