listing buddies through Perl plugin

Roy Rim roy.develpidgin at xemaps.com
Thu May 31 09:32:03 EDT 2007


Cool Sadrul.  The plugin I'm trying to write will eventually email
older logs and I figured writing it in perl would be simpler as I have
nearly no C experience.  I needed to iterate through the buddies so
that I could take advantage of the purple_log_get_logs( ... ) method.

One other way I tried was to go through the directory structure
starting with Purple::Util::user_dir() and then appending "/logs".
But I'm not sure how I can tell if a log is no longer written to.
Other than getting the log structure first and then calling
purple_log_is_deletable() is there some other way to tell if I am
allowed to remove a log file?

I would appreciate any suggestions.

Regards,
Roy Rim

On 5/31/07, Sadrul Habib Chowdhury <imadil at gmail.com> wrote:
> > >
> > > I've been pulling my hair out trying to understand how the Buddy List
> > > works.  I'm a C newbie and have never used the Perl internals before.
> > > How do I iterate through the buddy list after getting it with a call
> > > to Purple::get_blist()?  I understand that its a node but I can't make
> > > heads or tails of how to call the "next" node.
> > >
>
> If you want to go over all the nodes in the buddylist, then you would
> first do purple_blist_get_root(), which returns the root node of the
> buddylist (the buddylist is actually stored in a tree-structure). From
> the node you get, you can iteratively do purple_blist_node_next to get
> all the groups, chats, contacts and buddies in the list.
>
> Right now, these functions are not exposed for perl plugins, and from
> what I see, traversing over the buddylist is not possible from a perl
> plugin. I have exposed these two functions, and a new function
> purple_blist_node_get_type for perl. So in 2.1.0, you should be able to
> use something like the script in http://pidgin.im/~sadrul/pp/blist.pl to
> go over the buddy list.
>
> Sadrul
>




More information about the Devel mailing list