diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2018-02-05 22:29:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-05 22:29:35 +0100 |
commit | f8fbc1e1ab9b01c651c7da0652eac8631894c44c (patch) | |
tree | 4622a6b8b545c36a4d539626ad741f1e56387fcf /src/perl | |
parent | 81831806132608d5111ffb24efd2a2469c62d197 (diff) | |
parent | 260733475c2b701c35024a3b4fbe900751b45341 (diff) | |
download | irssi-f8fbc1e1ab9b01c651c7da0652eac8631894c44c.zip |
Merge pull request #775 from LemonBoy/caps_kv
CAP 3.2 support
Diffstat (limited to 'src/perl')
-rw-r--r-- | src/perl/irc/Irc.xs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs index 41690010..bb2d27bb 100644 --- a/src/perl/irc/Irc.xs +++ b/src/perl/irc/Irc.xs @@ -12,7 +12,10 @@ 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) { AV *av; + HV *hv_; GSList *tmp; + GHashTableIter iter; + gpointer key_, val_; perl_irc_connect_fill_hash(hv, server->connrec); perl_server_fill_hash(hv, (SERVER_REC *) server); @@ -34,10 +37,14 @@ static void perl_irc_server_fill_hash(HV *hv, IRC_SERVER_REC *server) (void) hv_store(hv, "cap_complete", 12, newSViv(server->cap_complete), 0); (void) hv_store(hv, "sasl_success", 12, newSViv(server->sasl_success), 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); + hv_ = newHV(); + g_hash_table_iter_init(&iter, server->cap_supported); + while (g_hash_table_iter_next(&iter, &key_, &val_)) { + char *key = (char *)key_; + char *val = (char *)val_; + hv_store(hv_, key, strlen(key), new_pv(val), 0); + } + (void) hv_store(hv, "cap_supported", 13, newRV_noinc((SV*)hv_), 0); av = newAV(); for (tmp = server->cap_active; tmp != NULL; tmp = tmp->next) |