diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2016-09-22 17:10:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-22 17:10:33 +0200 |
commit | 31044ec00477a2fc89064e6b54c933c2c59fc076 (patch) | |
tree | 6577616d4544de9924448ddadc3956e2c6553d9a /src/perl | |
parent | 1405a87b56c3d71e63a647f71cadcd67f8300040 (diff) | |
parent | 0e0d99587a9e2daa091d48adedfbf420cad21758 (diff) | |
download | irssi-31044ec00477a2fc89064e6b54c933c2c59fc076.zip |
Merge pull request #542 from LemonBoy/xs-add
Expose the CAP fields to the perl scripts.
Diffstat (limited to 'src/perl')
-rw-r--r-- | src/perl/irc/Irc.xs | 25 | ||||
-rw-r--r-- | src/perl/irc/Server.xs | 9 | ||||
-rw-r--r-- | src/perl/irc/module.h | 1 |
3 files changed, 30 insertions, 5 deletions
diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs index 3f8ccc2e..8b3b0c45 100644 --- a/src/perl/irc/Irc.xs +++ b/src/perl/irc/Irc.xs @@ -11,12 +11,15 @@ static void perl_irc_connect_fill_hash(HV *hv, IRC_SERVER_CONNECT_REC *conn) static void perl_irc_server_fill_hash(HV *hv, IRC_SERVER_REC *server) { - perl_irc_connect_fill_hash(hv, server->connrec); - perl_server_fill_hash(hv, (SERVER_REC *) server); + AV *av; + GSList *tmp; + + perl_irc_connect_fill_hash(hv, server->connrec); + perl_server_fill_hash(hv, (SERVER_REC *) server); - (void) hv_store(hv, "real_address", 12, new_pv(server->real_address), 0); - (void) hv_store(hv, "usermode", 8, new_pv(server->usermode), 0); - (void) hv_store(hv, "userhost", 8, new_pv(server->userhost), 0); + (void) hv_store(hv, "real_address", 12, new_pv(server->real_address), 0); + (void) hv_store(hv, "usermode", 8, new_pv(server->usermode), 0); + (void) hv_store(hv, "userhost", 8, new_pv(server->userhost), 0); (void) hv_store(hv, "max_cmds_at_once", 16, newSViv(server->max_cmds_at_once), 0); (void) hv_store(hv, "cmd_queue_speed", 15, newSViv(server->cmd_queue_speed), 0); @@ -27,6 +30,18 @@ static void perl_irc_server_fill_hash(HV *hv, IRC_SERVER_REC *server) (void) hv_store(hv, "max_modes_in_cmd", 16, newSViv(server->max_modes_in_cmd), 0); (void) hv_store(hv, "max_whois_in_cmd", 16, newSViv(server->max_whois_in_cmd), 0); (void) hv_store(hv, "isupport_sent", 13, newSViv(server->isupport_sent), 0); + + (void) hv_store(hv, "cap_complete", 12, newSViv(server->cap_complete), 0); + + av = newAV(); + for (tmp = server->cap_supported; tmp != NULL; tmp = tmp->next) + av_push(av, new_pv(tmp->data)); + (void) hv_store(hv, "cap_supported", 13, newRV_noinc((SV*)av), 0); + + av = newAV(); + for (tmp = server->cap_active; tmp != NULL; tmp = tmp->next) + av_push(av, new_pv(tmp->data)); + (void) hv_store(hv, "cap_active", 10, newRV_noinc((SV*)av), 0); } static void perl_ban_fill_hash(HV *hv, BAN_REC *ban) diff --git a/src/perl/irc/Server.xs b/src/perl/irc/Server.xs index 0e9ec672..33417bf5 100644 --- a/src/perl/irc/Server.xs +++ b/src/perl/irc/Server.xs @@ -149,3 +149,12 @@ CODE: OUTPUT: RETVAL +int +irc_server_cap_toggle(server, cap, enable) + Irssi::Irc::Server server + char *cap + int enable +CODE: + RETVAL = cap_toggle(server, cap, enable); +OUTPUT: + RETVAL diff --git a/src/perl/irc/module.h b/src/perl/irc/module.h index 91c19c7a..a2454545 100644 --- a/src/perl/irc/module.h +++ b/src/perl/irc/module.h @@ -6,6 +6,7 @@ #include "irc-queries.h" #include "irc-nicklist.h" #include "irc-masks.h" +#include "irc-cap.h" #include "bans.h" #include "modes.h" |