From 4b44d000eebc6d61745b3ddd09548815c30be2d2 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Fri, 20 Jul 2012 18:19:11 +0200 Subject: [PATCH] Add support of object type "arr" (array) in protocol --- src/qweechat/weechat/protocol.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qweechat/weechat/protocol.py b/src/qweechat/weechat/protocol.py index bb7eebb..f993352 100644 --- a/src/qweechat/weechat/protocol.py +++ b/src/qweechat/weechat/protocol.py @@ -108,6 +108,7 @@ class Protocol: 'hda': self._obj_hdata, 'inf': self._obj_info, 'inl': self._obj_infolist, + 'arr': self._obj_array, } def _obj_type(self): @@ -250,6 +251,15 @@ class Protocol: items.append(variables) return {'name': name, 'items': items} + def _obj_array(self): + """Read an array of values in data.""" + type_values = self._obj_type() + count_values = self._obj_int() + values = [] + for i in range(0, count_values): + values.append(self._obj_cb[type_values]()) + return values + def decode(self, data): """Decode binary data and return list of objects.""" self.data = data