diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | doc/en/weechat_relay_protocol.en.adoc | 19 | ||||
-rw-r--r-- | doc/fr/weechat_relay_protocol.fr.adoc | 20 | ||||
-rw-r--r-- | doc/ja/weechat_relay_protocol.ja.adoc | 21 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-protocol.c | 10 |
5 files changed, 68 insertions, 3 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 8aaeba661..ca48a3e5a 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -32,6 +32,7 @@ Improvements:: Bug fixes:: * api: fix crash in function string_split_command() when the separator is not a semicolon (issue #731) + * relay: return an empty hdata when the requested hdata or pointer is not found (issue #767) Documentation:: diff --git a/doc/en/weechat_relay_protocol.en.adoc b/doc/en/weechat_relay_protocol.en.adoc index 0bf757190..32534abb5 100644 --- a/doc/en/weechat_relay_protocol.en.adoc +++ b/doc/en/weechat_relay_protocol.en.adoc @@ -164,6 +164,11 @@ values are: * negative number: iterate using previous element, N times * _*_: iterate using next element, until end of list +[NOTE] +With WeeChat ≥ 1.6, if the hdata path is invalid or if a NULL pointer is found, +an empty hdata is returned (see example in <<object_hdata,hdata object>>). + +With older versions, nothing was returned. + Examples: ---- @@ -1618,6 +1623,20 @@ nicklist nick (@ChanServ) .... +Example of empty hdata (hotlist is empty in WeeChat): + +.... +# command +hdata hotlist:gui_hotlist(*) + +# response +┌────────┬────────┬───┐ +│ (NULL) │ (NULL) │ 0 │ +└────────┴────────┴───┘ + └──────┘ └──────┘ └─┘ + h-path keys count +.... + [[object_info]] ==== Info diff --git a/doc/fr/weechat_relay_protocol.fr.adoc b/doc/fr/weechat_relay_protocol.fr.adoc index cf62ee965..a4fbad4ad 100644 --- a/doc/fr/weechat_relay_protocol.fr.adoc +++ b/doc/fr/weechat_relay_protocol.fr.adoc @@ -170,6 +170,12 @@ Les valeurs possibles sont : * nombre négatif : itérer en utilisant l'élément précédent, N fois * _*_ : itérer en utilisant l'élément suivant, jusqu'à la fin de la liste +[NOTE] +Avec WeeChat ≥ 1.6, si le chemin vers le hdata est invalide ou si un pointeur +NULL est trouvé, un hdata vide est retourné (voir l'exemple dans +<<object_hdata,l'objet hdata>>). + +Avec des versions plus anciennes, rien n'était retourné. + Exemples : ---- @@ -1651,6 +1657,20 @@ nicklist pseudo (@ChanServ) .... +Exemple de hdata vide (la hotlist est vide dans WeeChat) : + +.... +# commande +hdata hotlist:gui_hotlist(*) + +# réponse +┌────────┬────────┬───┐ +│ (NULL) │ (NULL) │ 0 │ +└────────┴────────┴───┘ + └──────┘ └──────┘ └─┘ + h-path clés nombre +.... + [[object_info]] ==== Info diff --git a/doc/ja/weechat_relay_protocol.ja.adoc b/doc/ja/weechat_relay_protocol.ja.adoc index 7da957e79..1c0f9f060 100644 --- a/doc/ja/weechat_relay_protocol.ja.adoc +++ b/doc/ja/weechat_relay_protocol.ja.adoc @@ -171,6 +171,12 @@ _hdata_ を要求。 * 負数: N 回前の要素への反復を繰り返す * _*_: 最後の要素まで、次の要素への反復を繰り返す +[NOTE] +// TRANSLATION MISSING +With WeeChat ≥ 1.6, if the hdata path is invalid or if a NULL pointer is found, +an empty hdata is returned (see example in <<object_hdata,hdata object>>). + +With older versions, nothing was returned. + 例: ---- @@ -1624,6 +1630,21 @@ nicklist nick (@ChanServ) .... +// TRANSLATION MISSING +Example of empty hdata (hotlist is empty in WeeChat): + +.... +# コマンド +hdata hotlist:gui_hotlist(*) + +# 応答 +┌────────┬────────┬───┐ +│ (NULL) │ (NULL) │ 0 │ +└────────┴────────┴───┘ + └──────┘ └──────┘ └─┘ + h-path keys count +.... + [[object_info]] ==== インフォ diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c index 834984738..ab9835b18 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.c +++ b/src/plugins/relay/weechat/relay-weechat-protocol.c @@ -231,11 +231,15 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(hdata) msg = relay_weechat_msg_new (id); if (msg) { - if (relay_weechat_msg_add_hdata (msg, argv[0], - (argc > 1) ? argv_eol[1] : NULL)) + if (!relay_weechat_msg_add_hdata (msg, argv[0], + (argc > 1) ? argv_eol[1] : NULL)) { - relay_weechat_msg_send (client, msg); + relay_weechat_msg_add_type (msg, RELAY_WEECHAT_MSG_OBJ_HDATA); + relay_weechat_msg_add_string (msg, NULL); /* h-path */ + relay_weechat_msg_add_string (msg, NULL); /* keys */ + relay_weechat_msg_add_int (msg, 0); /* count */ } + relay_weechat_msg_send (client, msg); relay_weechat_msg_free (msg); } |