summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/perl
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-10-17 14:30:03 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-10-17 14:30:03 +0000
commit357d7c5a2fdc42eb9dc72413767280c0ffe94e0f (patch)
treeb9360f1e0c0b76058241e3e0e5f2b13018e25c8a /src/plugins/scripts/perl
parentb2ec60110c17716c9b7ad2e07ece6734db1c82e8 (diff)
downloadweechat-357d7c5a2fdc42eb9dc72413767280c0ffe94e0f.zip
Changes in plugins and scripts plugins:
- get_info("version") now returns only version - added get_config() function to read config options
Diffstat (limited to 'src/plugins/scripts/perl')
-rw-r--r--src/plugins/scripts/perl/weechat-perl.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c
index 543c39ba5..a39437958 100644
--- a/src/plugins/scripts/perl/weechat-perl.c
+++ b/src/plugins/scripts/perl/weechat-perl.c
@@ -452,6 +452,44 @@ static XS (XS_weechat_get_dcc_info)
}
/*
+ * weechat::get_config: get value of a config option
+ */
+
+static XS (XS_weechat_get_config)
+{
+ char *option, *value;
+ unsigned int integer;
+ dXSARGS;
+
+ /* make gcc happy */
+ (void) cv;
+
+ if (items != 1)
+ {
+ perl_plugin->printf_server (perl_plugin,
+ "Perl error: wrong parameters for "
+ "\"get_config\" function");
+ XSRETURN_NO;
+ }
+
+ option = SvPV (ST (0), integer);
+ if (option)
+ {
+ value = perl_plugin->get_config (perl_plugin, option);
+
+ if (value)
+ {
+ XST_mPV (0, value);
+ free (value);
+ }
+ else
+ XST_mPV (0, "");
+ }
+
+ XSRETURN (1);
+}
+
+/*
* weechat_perl_xs_init: initialize subroutines
*/
@@ -468,6 +506,7 @@ weechat_perl_xs_init (pTHX)
newXS ("weechat::add_command_handler", XS_weechat_add_command_handler, "weechat");
newXS ("weechat::get_info", XS_weechat_get_info, "weechat");
newXS ("weechat::get_dcc_info", XS_weechat_get_dcc_info, "weechat");
+ newXS ("weechat::get_config", XS_weechat_get_config, "weechat");
}
/*