weechat-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Weechat-support] Weechat 0.2.7: infolist_get to return all connecte


From: FlashCode
Subject: Re: [Weechat-support] Weechat 0.2.7: infolist_get to return all connected servers
Date: Sun, 26 Oct 2008 17:25:43 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

On Sun, Oct 26, 2008 at 04:42:29PM +0100, Leon Bogaert wrote:
> Hi all,
> 
> I'm trying to create a plugin for Weechat 0.2.7.
> 
> For that I need a list of all connected servers. I've tried a lot of things 
> like:
>   infolist = Weechat.infolist_get('irc_server', '', '')
> 
> But all infolist contains is a string. Usually something like: 0xe51600
> 
> Can somebody help me extracting the list of servers? 'Cause it's driving me 
> nuts!
> 
> Thanks in advance!
> Leon
> 

Hi Leon,

In fact infolist_get returns a pointer to infolist. Then you have to
use other infolist functions to extract values for variables in
infolist.
You can look for example at this script, which read infolist with
buffers:
http://weechat.flashtux.org/dev/scripts/buffers.pl

For example you can do something like that in perl:

my $infolist = weechat::infolist_get("irc_server", "", "");
while (weechat::infolist_next($infolist))
{
    weechat::print("", "server name = "
        .weechat::infolist_string($infolist, "name");
}
weechat::infolist_free($infolist);

If you want to see content of infolist, you can use demo plugin (you
have to enable this plugin when compiling weechat, it's not compiled
by default). You can use this command to see infolist returned by IRC
plugin with list of servers:

/demo_infolist irc_server

I'm currently writing doc for new API ;)

-- 
Cordialement / Best regards
Sebastien.

Web: http://www.flashtux.org - email: address@hidden
IRC: FlashCode on irc.freenode.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]