[libpurple] Is there a way to strip jid resource?

Paul Aurich darkrain42 at pidgin.im
Sun Jun 5 23:18:38 EDT 2011


And Michał Kazior spoke on 06/05/2011 03:01 PM, saying:
> Hello,
> 
> I'm trying to strip a jid resource, example:
>   bob at domain.tld/HomeXYZ  ->  bob at domain.tld
> 
> I know that I could just split it, but that seems wrong to me.
> Shouldn't it be possible to do it with libpurple alone?

The API libpurple exposes is generally protocol-neutral, but in this case,
you can generally call purple_normalize(account, "foo at example.com/Home"),
which will return the bare JID.

Note that if you pass a valid account AND the JID is part of an active MUC
(i.e. you're in it), you'll get the full JID.

That said, what the protocol plugin does is baiscally just split on @ and
/, so...

~Paul


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://pidgin.im/pipermail/support/attachments/20110605/8e578221/attachment.sig>


More information about the Support mailing list