1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-10 11:43:13 +02:00

relay: add object type "arr" (array) in WeeChat protocol

This commit is contained in:
Sebastien Helleu
2012-07-20 18:18:37 +02:00
parent eab0110732
commit bd7332455d
5 changed files with 196 additions and 69 deletions
+37
View File
@@ -519,6 +519,7 @@ available:
| hda | Hdata content | Variable
| inf | Info: name + content | Variable
| inl | Infolist content | Variable
| arr | Array of values | 3 bytes (type) + number of items + data
|=====================================================
[[object_char]]
@@ -831,6 +832,42 @@ infolist buffer
name count item 1 item 2
.......................................
[[object_array]]
Array
^^^^^
An array is a type (3 bytes) + number of items (integer on 4 bytes) + data.
Example of array with 2 strings:
.......................................
┌─────╥────┬────┬────┬────╥────┬────┬────┬────╥────┬────┬────╥────┬────┬────┬────╥────┬────┐
│ str ║ 00 │ 00 │ 00 │ 02 ║ 00 │ 00 │ 00 │ 03 ║ 61 │ 62 │ 63 ║ 00 │ 00 │ 00 │ 02 ║ 64 │ 65 │ ────► { "abc", "de" }
└─────╨────┴────┴────┴────╨────┴────┴────┴────╨────┴────┴────╨────┴────┴────┴────╨────┴────┘
└───┘ └─────────────────┘ └─────────────────┘ └────────────┘ └─────────────────┘ └───────┘
type number of strings length 'a' 'b' 'c' length 'd' 'e'
.......................................
Example of array with 3 integers:
.......................................
┌─────╥────┬────┬────┬────╥────┬────┬────┬────╥────┬────┬────┬────╥────┬────┬────┬────┐
│ int ║ 00 │ 00 │ 00 │ 03 ║ 00 │ 00 │ 00 │ 7B ║ 00 │ 00 │ 01 │ C8 ║ 00 │ 00 │ 03 │ 15 │ ────► { 123, 456, 789 }
└─────╨────┴────┴────┴────╨────┴────┴────┴────╨────┴────┴────┴────╨────┴────┴────┴────┘
└───┘ └─────────────────┘ └─────────────────┘ └─────────────────┘ └─────────────────┘
type number of integers 123 (0x7B) 456 (0x1C8) 789 (0x315)
.......................................
A 'NULL' array:
.......................................
┌─────╥────┬────┬────┬────┐
│ str ║ 00 │ 00 │ 00 │ 00 │ ────► NULL
└─────╨────┴────┴────┴────┘
└───┘ └─────────────────┘
type number of strings
.......................................
[[typical_session]]
Typical session
---------------