help regarding advanced protocol settings in purple account in libpurple

Mark Doliner mark at kingant.net
Fri Aug 27 01:52:03 EDT 2010


On Sun, Aug 22, 2010 at 8:35 AM, swagat mishra
<swagatmishra2007 at gmail.com> wrote:
> i am developing an IM client using libpurple to connect to takl.google.com.
> when i connect to gtalk using pidgin i specify the following settings under
> the advanced tab:
> protocol:xmpp
> in advanced tab:
> require ssl/tls
> force old port(5223)ssl
> connect port:443
> connect server:talk.google.com
> Proxy:No Proxy
>
> how can i specify these settings in my program.i think it has to be done in
> the settings field of purpleaccount structure,but how?

Is this for a gmail.com/googlemail.com account?  If so, it's better
not to specify connect server and let libpurple do a DNS SRV lookup.
That will allow Google to change the host name for their XMPP server
(it's actually more complicated than that... DNS SRV gives them the
option to distribute load and provide failover).

I also recomment not forcing old port ssl and not setting the connect
port, unless you need to in order to tunnel through a proxy or
firewall that blocks outgoing connections on port 5222.

Anyway, to answer your question:
PurpleAccount *account = purple_account_new("example at gmail.com", "prpl-jabber");
purple_account_set_bool(account, "require_tls", TRUE);
purple_account_set_bool(account, "old_ssl", TRUE);
purple_account_set_int(account, "port", 443);
purple_account_set_string(account, "connect_server", "talk.google.com");

But of course, the second argument to the
purple_account_set_whatever() functions is internal and subject to
change.  That is to say, it is not part of the public API.  You're
welcome to hardcode those strings in your application, but be aware
that they may change (although, probably unlikely).

Pidgin shows the above options to the user by iterating over
prpl_info->protocol_options for the jabber protocol plugin.

> the source code i am using is from the
> site:http://libpurple.com/writing-your-first-instant-messaging-program/

That's kind of a neat site.  I wasn't aware of it before.  I wonder if
that information should be on our wiki somewhere?  I guess that's kind
of up to the author (Michael C. Brook), since it looks like he owns
the copyright.  If he'd like to move the content to
http://developer.pidgin.im/ I certainly wouldn't complain.

--Mark




More information about the Support mailing list