summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/perl/weechat-perl.c
diff options
context:
space:
mode:
authorEmmanuel Bouthenot <kolter@openics.org>2005-12-02 22:26:40 +0000
committerEmmanuel Bouthenot <kolter@openics.org>2005-12-02 22:26:40 +0000
commit81224d93970e7096a2e02483cc3da1e647190471 (patch)
tree11a8052a47ffd09a743418924083e1f563b27851 /src/plugins/scripts/perl/weechat-perl.c
parenta114b7adc32bdc33a2f00d78a232196d7d65aa20 (diff)
downloadweechat-81224d93970e7096a2e02483cc3da1e647190471.zip
fix some typos and improve get_dcc_info
Diffstat (limited to 'src/plugins/scripts/perl/weechat-perl.c')
-rw-r--r--src/plugins/scripts/perl/weechat-perl.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c
index ca46868f1..c46f78480 100644
--- a/src/plugins/scripts/perl/weechat-perl.c
+++ b/src/plugins/scripts/perl/weechat-perl.c
@@ -122,8 +122,7 @@ weechat_perl_exec (t_weechat_plugin *plugin,
func = function;
PERL_SET_CONTEXT (script->interpreter);
#endif
- perl_current_script = script;
-
+
dSP;
ENTER;
SAVETMPS;
@@ -135,8 +134,12 @@ weechat_perl_exec (t_weechat_plugin *plugin,
argv[1] = arguments;
argv[2] = NULL;
+ perl_current_script = script;
+
count = perl_call_argv (func, G_EVAL | G_SCALAR, argv);
+ perl_current_script = NULL;
+
SPAGAIN;
sv = GvSV (gv_fetchpv ("@", TRUE, SVt_PV));
@@ -560,6 +563,9 @@ static XS (XS_weechat_get_dcc_info)
{
t_plugin_dcc_info *dcc_info, *ptr_dcc;
int dcc_count;
+ char timebuffer1[64];
+ char timebuffer2[64];
+ struct in_addr in;
dXSARGS;
/* make gcc happy */
@@ -582,15 +588,21 @@ static XS (XS_weechat_get_dcc_info)
for (ptr_dcc = dcc_info; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
+ strftime(timebuffer1, sizeof(timebuffer1), "%F %T",
+ localtime(&ptr_dcc->start_time));
+ strftime(timebuffer2, sizeof(timebuffer2), "%F %T",
+ localtime(&ptr_dcc->start_transfer));
+ in.s_addr = htonl(ptr_dcc->addr);
+
HV *infohash = (HV *) sv_2mortal((SV *) newHV());
hv_store (infohash, "server", 6, newSVpv (ptr_dcc->server, 0), 0);
hv_store (infohash, "channel", 7, newSVpv (ptr_dcc->channel, 0), 0);
hv_store (infohash, "type", 4, newSViv (ptr_dcc->type), 0);
hv_store (infohash, "status", 6, newSViv (ptr_dcc->status), 0);
- hv_store (infohash, "start_time", 10, newSViv (ptr_dcc->start_time), 0);
- hv_store (infohash, "start_transfer", 14, newSViv (ptr_dcc->start_transfer), 0);
- hv_store (infohash, "address", 7, newSViv (ptr_dcc->addr), 0);
+ hv_store (infohash, "start_time", 10, newSVpv (timebuffer1, 0), 0);
+ hv_store (infohash, "start_transfer", 14, newSVpv (timebuffer2, 0), 0);
+ hv_store (infohash, "address", 7, newSVpv (inet_ntoa(in), 0), 0);
hv_store (infohash, "port", 4, newSViv (ptr_dcc->port), 0);
hv_store (infohash, "nick", 4, newSVpv (ptr_dcc->nick, 0), 0);
hv_store (infohash, "remote_file", 11, newSVpv (ptr_dcc->filename, 0), 0);