relay: return an empty hdata when the requested hdata or pointer is not found (closes #767)

v2.8-utf8proc
Sébastien Helleu 2016-07-29 15:55:42 +02:00
parent 4397dccd1b
commit 09c52755d1
5 changed files with 68 additions and 3 deletions

View File

@ -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::

View File

@ -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

View File

@ -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

View File

@ -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]]
==== インフォ

View File

@ -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);
}