add in blist request, fake home dir

Mark Doliner mark at kingant.net
Sun Feb 10 03:50:47 EST 2008


On Sun, 10 Feb 2008 08:40:48 +0100, Anatoliy Belsky wrote
> On Saturday 09 February 2008, Mark Doliner wrote:
> > I think you could use purple_find_buddies() or purple_find_buddy().  If it
> > returns NULL then the person is not in your buddy list.
> 
> pbuddy = purple_find_buddy(paccount, !who ? 
> purple_conversation_get_name(conv) : who);
> 		
> if(!pbuddy) {
> 	pbuddy = purple_buddy_new(paccount, !who ? 
> purple_conversation_get_name(conv) : who, NULL);
> }
> 
> if(purple_find_buddy(paccount, !who ? 
> purple_conversation_get_name(conv) : who)) { 	/*shouldn't come into this*/
> 	php_printf("the buddy is found\n");
> }
> 
> so this piece of code worked, but I don't understand why ...) the 
> buddy was created but isn't on the blist and will not be 
> automatically saved... this is the case, where we become messages 
> from the buddies, which aren't in our blist .. ok, this is exactly 
> what i need

I'm confused.  Why would you want to call purple_buddy_new()?  Why would you
create a PurpleBuddy object for someone not in your buddy list?  It seems like
it would be better if your code just handled the case where pbuddy is NULL.

> i would ask a couple of questions more:
> 
> - while creating an account one must provide the password/username 
> pair and use purple_account_new, purple_account_set_password and so 
> on. One thing i can't find is - how i could set the server address 
> and port. Or is this read from the xml only?

It sounds like you're talking about PRPL-specific account settings.  You can
see the list of available settings for a given protocol by looking at
prpl_info->protocol_options, and you can set settings using
purple_account_set_string(), purple_account_set_int() and
purple_account_set_bool().

> - is there any info, how many accounts/buddies/groups etc. can 
> libpurple hold at once?

There is no available information about that.  libpurple doesn't limit the
number of accounts, buddies, groups, or really anything.  Which means you're
bound only by the amount of memory on your system or the decreasing
performance of searching through gigantic linked lists of accounts or
iterating through a gigantic list of buddies.

-Mark




More information about the Devel mailing list