problem getting status of buddies?

Daniel Atallah daniel.atallah at gmail.com
Thu May 6 09:49:09 EDT 2010


On Thu, May 6, 2010 at 01:33, sandeep <sandeep at konstantinfo.com> wrote:
> Hello Support,
>
> We are using nullclient.c for libpurple to get contacts of account...
>
> but there is some problem to get status of buddies.. we are using code
> below...
>
> ......................................................
>
>
> static void
> show_buddy_list_from_active_accounts()
> {
> GList *accounts = purple_accounts_get_all_active();
> for (; accounts; accounts = g_list_delete_link(accounts, accounts)) {
> GSList *buddies = purple_find_buddies(accounts->data, NULL);
> for (; buddies; buddies = g_slist_delete_link(buddies,buddies)) {
> PurpleBuddy *b = buddies->data;
> PurplePresence *p = purple_buddy_get_presence(b);
> PurpleStatus *s = purple_presence_get_active_status(p);
>
>
> //printf("\n%s",
> purple_primitive_get_id_from_type(purple_status_type_get_primitive(purple_status_get_type(s))));
>
> printf("status = %s buddy = %s\n",
> purple_status_get_name(s),
> purple_buddy_get_name(b));
> }
> }
> }
>
>
>
> static void
> signed_on(PurpleConnection *gc, gpointer null)
> {
> PurpleAccount *account = purple_connection_get_account(gc);
> printf("Account connected: %s %s\n", account->username,
> account->protocol_id);
>
> //printf("%s\n", "verma");
>
> sleep(10);
>
> purple_accounts_add(account);
> show_buddy_list_from_active_accounts();
>
> listaContatos(); //exit(0);
> }
>
>
> ..............................................................
>
>
> [root at COMP63 nullclient]# ./presense 15 ompriamapi at gmail.com ******
> Account connected: ompriamapi at gmail.com prpl-jabber
>
> status = Offline buddy = testprojectsnow at gmail.com
> status = Offline buddy = no-reply at groovetap.com
>
> here you can see buddies always Offline.. please suggest what solution we
> need to use?
>
> Please provide magic touch to get alternate method to get buddies status :)
>
> Thanks for your understanding...

You probably are attempting to look at the status before it has been
received from the server.

When an account has "signed-on", it doesn't mean that the the roster
has been retrieved fully yet.

-D




More information about the Devel mailing list