summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/perl/weechat-perl.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2006-02-04 15:25:18 +0000
committerSebastien Helleu <flashcode@flashtux.org>2006-02-04 15:25:18 +0000
commit6013e43292bb1a9f8dc40d3c0b8611151d606145 (patch)
tree9d24e86f959d9feccba7ee7dcd2610de27592b3f /src/plugins/scripts/perl/weechat-perl.c
parent9150cff430c5fe794e0429b298313e30811ad7ac (diff)
downloadweechat-6013e43292bb1a9f8dc40d3c0b8611151d606145.zip
Minor changes on server/channel/nick info API functions
Diffstat (limited to 'src/plugins/scripts/perl/weechat-perl.c')
-rw-r--r--src/plugins/scripts/perl/weechat-perl.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c
index e30eb6491..6dec3fe82 100644
--- a/src/plugins/scripts/perl/weechat-perl.c
+++ b/src/plugins/scripts/perl/weechat-perl.c
@@ -825,22 +825,25 @@ static XS (XS_weechat_get_server_info)
}
server_info = perl_plugin->get_server_info (perl_plugin);
- if (!server_info) {
+ if (!server_info)
+ {
XSRETURN_EMPTY;
- }
-
+ }
HV *server_hash = (HV *) sv_2mortal((SV *) newHV());
if (!server_hash)
+ {
+ perl_plugin->free_server_info (perl_plugin, server_info);
XSRETURN_EMPTY;
+ }
- for (ptr_server = server_info; ptr_server; ptr_server = ptr_server->next_info)
+ for (ptr_server = server_info; ptr_server; ptr_server = ptr_server->next_server)
{
strftime(timebuffer, sizeof(timebuffer), "%F %T",
localtime(&ptr_server->away_time));
HV *server_hash_member = (HV *) sv_2mortal((SV *) newHV());
-
+
hv_store (server_hash_member, "autoconnect", 11, newSViv (ptr_server->autoconnect), 0);
hv_store (server_hash_member, "autoreconnect", 13, newSViv (ptr_server->autoreconnect), 0);
hv_store (server_hash_member, "autoreconnect_delay", 19, newSViv (ptr_server->autoreconnect_delay), 0);
@@ -913,15 +916,19 @@ static XS (XS_weechat_get_channel_info)
XSRETURN_EMPTY;
channel_info = perl_plugin->get_channel_info (perl_plugin, server);
- if (!channel_info) {
+ if (!channel_info)
+ {
XSRETURN_EMPTY;
}
HV *channel_hash = (HV *) sv_2mortal((SV *) newHV());
if (!channel_hash)
+ {
+ perl_plugin->free_channel_info (perl_plugin, channel_info);
XSRETURN_EMPTY;
+ }
- for (ptr_channel = channel_info; ptr_channel; ptr_channel = ptr_channel->next_info)
+ for (ptr_channel = channel_info; ptr_channel; ptr_channel = ptr_channel->next_channel)
{
HV *channel_hash_member = (HV *) sv_2mortal((SV *) newHV());
@@ -977,13 +984,17 @@ static XS (XS_weechat_get_nick_info)
XSRETURN_EMPTY;
nick_info = perl_plugin->get_nick_info (perl_plugin, server, channel);
- if (!nick_info) {
+ if (!nick_info)
+ {
XSRETURN_EMPTY;
}
HV *nick_hash = (HV *) sv_2mortal((SV *) newHV());
if (!nick_hash)
+ {
+ perl_plugin->free_nick_info (perl_plugin, nick_info);
XSRETURN_EMPTY;
+ }
for (ptr_nick = nick_info; ptr_nick; ptr_nick = ptr_nick->next_nick)
{